Composer
class Composer
Traits
Properties
| protected Filesystem | $files | The filesystem instance. |
|
| protected string|null | $workingPath | The working path to regenerate from. |
|
| static protected ClassLoader|null | $classLoader | The cached Composer autoloader instance. |
Methods
Stop the process if its output callback fails.
Create a new Composer manager instance.
Determine if the given Composer package is installed.
Install the given Composer packages into the application.
Remove the given Composer packages from the application.
Modify the "composer.json" file contents using the given callback.
Regenerate the Composer autoloader files.
Regenerate the optimized Composer autoloader files.
Get the Composer binary / command for the environment.
Get the path to the "composer.json" file.
Get the basic permission bits for the Composer file.
Get the PHP binary.
Get a new Symfony process instance.
Set the working path used by the class.
Get the version of Composer.
Get the Composer autoloader instance.
Set the Composer autoloader instance.
Find the application Composer autoloader registered with a vendor directory.
Get the root package of the application's Composer installation.
Get the vendor directory of the Composer install rooted at the given path.
Flush all static state.
Details
in
GuardsProcessOutput at line 17
protected Closure|null
guardProcessOutput(Process $process, callable|null $output)
Stop the process if its output callback fails.
at line 45
__construct(Filesystem $files, string|null $workingPath = null)
Create a new Composer manager instance.
at line 57
bool
hasPackage(string $package)
Determine if the given Composer package is installed.
at line 70
bool
requirePackages(array $packages, bool $dev = false, Closure|OutputInterface|null $output = null, string|null $composerBinary = null)
Install the given Composer packages into the application.
at line 97
bool
removePackages(array $packages, bool $dev = false, Closure|OutputInterface|null $output = null, string|null $composerBinary = null)
Remove the given Composer packages from the application.
at line 127
void
modify(callable $callback)
Modify the "composer.json" file contents using the given callback.
at line 151
int
dumpAutoloads(string|array $extra = '', string|null $composerBinary = null)
Regenerate the Composer autoloader files.
at line 163
int
dumpOptimized(string|null $composerBinary = null)
Regenerate the optimized Composer autoloader files.
at line 173
array
findComposer(string|null $composerBinary = null)
Get the Composer binary / command for the environment.
at line 190
protected string
findComposerFile()
Get the path to the "composer.json" file.
at line 204
protected int
fileMode(string $path)
Get the basic permission bits for the Composer file.
at line 220
protected string
phpBinary()
Get the PHP binary.
at line 231
protected Process
getProcess(array $command, array $env = [])
Get a new Symfony process instance.
at line 241
Composer
setWorkingPath(string $path)
Set the working path used by the class.
at line 251
string|null
getVersion()
Get the version of Composer.
at line 274
static ClassLoader
getLoader()
Get the Composer autoloader instance.
Static because AOP proxy generation needs autoloader access during bootstrap, before the container is available.
at line 285
static ClassLoader
setLoader(ClassLoader $classLoader)
Set the Composer autoloader instance.
Swaps the cached Composer loader for the worker lifetime and affects every subsequent class-map registration.
at line 297
static protected ClassLoader
findLoader()
Find the application Composer autoloader registered with a vendor directory.
A tool shipped as a PHAR, such as PHPStan, registers its own autoloader first, so a loader outside a PHAR is preferred.
at line 323
static array
rootPackage()
Get the root package of the application's Composer installation.
A tool shipped as a PHAR, such as PHPStan, registers its own installation first, so InstalledVersions::getRootPackage() returns the tool's. The first installation outside a PHAR is preferred.
at line 341
static string
vendorPath(string $rootPath)
Get the vendor directory of the Composer install rooted at the given path.
The loaded install records its own root, so a vendor directory chosen through project or global configuration, or while installing, needs no Composer configuration parsing. A relative COMPOSER_VENDOR_DIR is relative to the root.
at line 385
static void
flushState()
Flush all static state.