public function removePackage(array $packageNames, $areDevPackages = false)
    {
        $packages = $this->formatPackageNames($packageNames);
        $file = $this->embeddedComposer->getExternalComposerFilename();
        $jsonFile = new JsonFile($file);
        $json = new JsonConfigSource($jsonFile);
        $composerDefinition = $jsonFile->read();
        $type = $areDevPackages ? 'require-dev' : 'require';

        foreach ($packages as $name => $version) {
            if (isset($composerDefinition[$type][$name])) {
                $json->removeLink($type, $name);
                unset($composerDefinition[$type][$name]);

                continue;
            }

            $this->io->writeError(sprintf(
               'Package: "%s" is not required and has not been removed.',
               $name
            ));
        }

        return $composerDefinition[$type];
    }
public function removePackage(array $packageNames, $areDevPackages = false)
    {
        $packages = $this->formatPackageNames($packageNames);
        $file = $this->embeddedComposer->getExternalComposerFilename();
        $jsonFile = new JsonFile($file);
        $json = new JsonConfigSource($jsonFile);
        $composerDefinition = $jsonFile->read();
        $type = $areDevPackages ? 'require-dev' : 'require';

        foreach ($packages as $name => $version) {
            if (isset($composerDefinition[$type][$name])) {
                $json->removeLink($type, $name);
                unset($composerDefinition[$type][$name]);

                continue;
            }

            $this->io->writeError(sprintf(
               'Package: "%s" is not required and has not been removed.',
               $name
            ));
        }

        return $composerDefinition[$type];
    }
public function removePackage ( array $ packageNames , $ areDevPackages = false ) { $ packages = $ this -> formatPackageNames ( $ packageNames ) ; $ file = $ this -> embeddedComposer -> getExternalComposerFilename ( ) ; $ jsonFile = new JsonFile ( $ file ) ; $ json = new JsonConfigSource ( $ jsonFile ) ; $ composerDefinition = $ jsonFile -> read ( ) ; $ type = $ areDevPackages ? 'require-dev' : 'require' ; foreach ( $ packages as $ name => $ version ) { if ( isset ( $ composerDefinition [ $ type ] [ $ name ] ) ) { $ json -> removeLink ( $ type , $ name ) ; unset ( $ composerDefinition [ $ type ] [ $ name ] ) ; continue ; } $ this -> io -> writeError ( sprintf ( 'Package: "%s" is not required and has not been removed.' , $ name ) ) ; } return $ composerDefinition [ $ type ] ; }
Remove a set of packages of the current Composer file.

@param array $packageNames
@param bool  $areDevPackages

@return array List of package's name as a key and the package's version
as value
Remove a set of packages of the current Composer file .