public function getInstalledPackages()
    {
        $packages = [];

        $content = $this->getFileContents('composer.lock');

        foreach (['packages', 'packages-dev'] as $key) {
            if (!isset($content[$key])) {
                continue;
            }

            foreach ($content[$key] as $package) {
                $name = $package['name'];

                $packages[$name] = [
                    'name' => $name,
                    'version' => $package['version'],
                    'devDependency' => $key === 'packages-dev',
                ];
            }
        }

        if (empty($packages)) {
            throw new LogicException('We couldn\'t find any installed packages.');
        }

        return $packages;
    }
public function getInstalledPackages()
    {
        $packages = [];

        $content = $this->getFileContents('composer.lock');

        foreach (['packages', 'packages-dev'] as $key) {
            if (!isset($content[$key])) {
                continue;
            }

            foreach ($content[$key] as $package) {
                $name = $package['name'];

                $packages[$name] = [
                    'name' => $name,
                    'version' => $package['version'],
                    'devDependency' => $key === 'packages-dev',
                ];
            }
        }

        if (empty($packages)) {
            throw new LogicException('We couldn\'t find any installed packages.');
        }

        return $packages;
    }
public function getInstalledPackages ( ) { $ packages = [ ] ; $ content = $ this -> getFileContents ( 'composer.lock' ) ; foreach ( [ 'packages' , 'packages-dev' ] as $ key ) { if ( ! isset ( $ content [ $ key ] ) ) { continue ; } foreach ( $ content [ $ key ] as $ package ) { $ name = $ package [ 'name' ] ; $ packages [ $ name ] = [ 'name' => $ name , 'version' => $ package [ 'version' ] , 'devDependency' => $ key === 'packages-dev' , ] ; } } if ( empty ( $ packages ) ) { throw new LogicException ( 'We couldn\'t find any installed packages.' ) ; } return $ packages ; }
Get installed package versions.

@throws \LogicException

@return array
Get installed package versions .