Manager super class for working with Composer

Protected Properties

protected IOInterface $output

protected string $workingDir

protected array $namespacePool

protected array $psr4Pool

protected array $classMapPool

protected array $includeFilesPool

protected Composer\Autoload\ClassLoader $loader

loader for the primary composer instance.

protected string $composerBackup

composerBackup contents

protected static ?static $instance

Public Methods

public addAuthCredentials()

public addAuthCredentials($hostname, $username, $password, $type = null): void

addAuthCredentials will add credentials to an auth config file

public addOctoberRepository()

public addOctoberRepository($url): void

public addPackages()

public addPackages($requirements): void

addPackages without update

public addRepository()

public addRepository($name, $type, $address, $options = []): void

addRepository will add a repository to the composer config

public autoload()

public autoload(string $vendorPath): void 

autoload is a similar function to including vendor/autoload.php.

public static forgetInstance()

public static forgetInstance(): void

forgetInstance if it exists

public getAuthCredentials()

public getAuthCredentials($hostname, $type = null): array|null 

getAuthCredentials returns auth credentials added to the config file

public getOutputBuffer()

public getOutputBuffer(): string 

public getPackageVersions()

public getPackageVersions($packageNames): array 

getPackageVersions returns version numbers for the specified packages

public hasPackage()

public hasPackage($name): bool 

hasPackage returns true if the specified package is installed

public hasRepository()

public hasRepository($address): bool 

hasRepository return true if the composer config contains the repo address

public init()

public init(): void

init singleton

public static instance()

public static instance(): void

instance create a new instance of this singleton

public listAllPackages()

public listAllPackages(): void

listAllPackages returns a list of installed packages, including dependencies

public listPackages()

public listPackages(): void

listPackages returns a list of directly installed packages

public remove()

public remove($packageNames): void

remove runs the "composer remove" command

public removePackages()

public removePackages($packageNames): void

removePackages without update

public removeRepository()

public removeRepository($name): void

removeRepository will remove a repository from the composer config

public require()

public require($requirements): void

require runs the "composer require" command

public setOutput()

public setOutput($output = null): void

public setOutputBuffer()

public setOutputBuffer(): void

public setOutputCommand()

public setOutputCommand($command, $input): void

public update()

public update($packages = []): void

update runs the "composer update" command

Protected Methods

protected __construct()

protected __construct(): void

protected assertComposerWarmedUp()

protected assertComposerWarmedUp(): void

assertComposerWarmedUp preloads composer in case it wants to update itself

protected assertEnvironmentReady()

protected assertEnvironmentReady(): void

protected assertHomeDirectory()

protected assertHomeDirectory(): void

protected assertHomeVariableSet()

protected assertHomeVariableSet(): void

protected assertPackageLoaded()

protected assertPackageLoaded($packageName, $packagePath, $recursive = true): void

assertPackageLoaded ensures all classes in a package are loaded

protected assertWorkingDirectory()

protected assertWorkingDirectory(): void

protected backupComposerFile()

protected backupComposerFile(): void

protected getAuthPath()

protected getAuthPath(): string 

getAuthPath returns a path to the auth.json file

protected getJsonPath()

protected getJsonPath(): string 

getJsonPath returns a path to the composer.json file

protected initAutoloader()

protected initAutoloader(): void

protected listPackagesInternal()

protected listPackagesInternal($useDirect = true): void

listPackagesInternal returns a list of installed packages

protected makeComposer()

protected makeComposer(): Composer\Composer 

makeComposer returns a new instance of composer

protected normalizeVersion()

protected normalizeVersion($packageVersion): void

protected preloadIncludeFilesPool()

protected preloadIncludeFilesPool(): void

protected preloadPools()

protected preloadPools(): void

protected restoreComposerFile()

protected restoreComposerFile(): void

protected stripVendorDir()

protected stripVendorDir(string $path, $vendorDir): string 

stripVendorDir removes the vendor directory from a path.

protected writePackages()

protected writePackages($requirements): void

writePackages stores package changes to disk. The requirements key is the package name and the value is the version constraint or false to remove the requirement.