public static function getPackagesAndDependencies($packagesArray)
    {
        foreach ($packagesArray as $key => $value) {
            $packageFile = base_path("/vendor/{$key}/composer.json");

            if ($key !== 'php' && file_exists($packageFile)) {
                $json2 = file_get_contents($packageFile);
                $dependenciesArray = json_decode($json2, true);
                $dependencies = array_key_exists('require', $dependenciesArray) ? $dependenciesArray['require'] : 'No dependencies';
                $devDependencies = array_key_exists('require-dev', $dependenciesArray) ? $dependenciesArray['require-dev'] : 'No dependencies';

                $packages[] = [
                    'name' => $key,
                    'version' => $value,
                    'dependencies' => $dependencies,
                    'dev-dependencies' => $devDependencies
                ];
            }
        }

        return $packages;
    }
public static function getPackagesAndDependencies($packagesArray)
    {
        foreach ($packagesArray as $key => $value) {
            $packageFile = base_path("/vendor/{$key}/composer.json");

            if ($key !== 'php' && file_exists($packageFile)) {
                $json2 = file_get_contents($packageFile);
                $dependenciesArray = json_decode($json2, true);
                $dependencies = array_key_exists('require', $dependenciesArray) ? $dependenciesArray['require'] : 'No dependencies';
                $devDependencies = array_key_exists('require-dev', $dependenciesArray) ? $dependenciesArray['require-dev'] : 'No dependencies';

                $packages[] = [
                    'name' => $key,
                    'version' => $value,
                    'dependencies' => $dependencies,
                    'dev-dependencies' => $devDependencies
                ];
            }
        }

        return $packages;
    }
public static function getPackagesAndDependencies ( $ packagesArray ) { foreach ( $ packagesArray as $ key => $ value ) { $ packageFile = base_path ( "/vendor/{$key}/composer.json" ) ; if ( $ key !== 'php' && file_exists ( $ packageFile ) ) { $ json2 = file_get_contents ( $ packageFile ) ; $ dependenciesArray = json_decode ( $ json2 , true ) ; $ dependencies = array_key_exists ( 'require' , $ dependenciesArray ) ? $ dependenciesArray [ 'require' ] : 'No dependencies' ; $ devDependencies = array_key_exists ( 'require-dev' , $ dependenciesArray ) ? $ dependenciesArray [ 'require-dev' ] : 'No dependencies' ; $ packages [ ] = [ 'name' => $ key , 'version' => $ value , 'dependencies' => $ dependencies , 'dev-dependencies' => $ devDependencies ] ; } } return $ packages ; }
Get Installed packages & their Dependencies

@param $packagesArray
@return array
Get Installed packages & their Dependencies