Composer
class Composer (View source)
Properties
| protected Filesystem | $files | The filesystem instance. | |
| protected string|null | $workingPath | The working path to regenerate from. |
Methods
| void | __construct(Filesystem $files, string|null $workingPath = null)
Create a new Composer manager instance. | |
| bool | hasPackage(string $package)
Determine if the given Composer package is installed. | |
| bool | requirePackages(array $packages, bool $dev = false, OutputInterface|null $output = null, string|null $composerBinary = null)
Install the given Composer packages into the application. | |
| bool | removePackages(array $packages, bool $dev = false, OutputInterface|null $output = null, string|null $composerBinary = null)
Remove the given Composer packages from the application. | |
| void | modify(callable $callback)
Modify the "composer.json" file contents using the given callback. | |
| int | dumpAutoloads(string|array $extra = '', string|null $composerBinary = null)
Regenerate the Composer autoloader files. | |
| int | dumpOptimized(string|null $composerBinary = null)
Regenerate the optimized Composer autoloader files. | |
| array | findComposer(string|null $composerBinary = null)
Get the Composer binary / command for the environment. | |
| string | findComposerFile()
Get the path to the "composer.json" file. | |
| string | phpBinary()
Get the PHP binary. | |
| Process | getProcess(array $command, array $env = [])
Get a new Symfony process instance. | |
| $this | setWorkingPath(string $path)
Set the working path used by the class. | |
| string|null | getVersion()
Get the version of Composer. |
Details
void __construct(Filesystem $files, string|null $workingPath = null)
Create a new Composer manager instance.
protected bool hasPackage(string $package)
Determine if the given Composer package is installed.
bool requirePackages(array $packages, bool $dev = false, OutputInterface|null $output = null, string|null $composerBinary = null)
Install the given Composer packages into the application.
bool removePackages(array $packages, bool $dev = false, OutputInterface|null $output = null, string|null $composerBinary = null)
Remove the given Composer packages from the application.
void modify(callable $callback)
Modify the "composer.json" file contents using the given callback.
int dumpAutoloads(string|array $extra = '', string|null $composerBinary = null)
Regenerate the Composer autoloader files.
int dumpOptimized(string|null $composerBinary = null)
Regenerate the optimized Composer autoloader files.
array findComposer(string|null $composerBinary = null)
Get the Composer binary / command for the environment.
protected string findComposerFile()
Get the path to the "composer.json" file.
protected string phpBinary()
Get the PHP binary.
protected Process getProcess(array $command, array $env = [])
Get a new Symfony process instance.
$this setWorkingPath(string $path)
Set the working path used by the class.
string|null getVersion()
Get the version of Composer.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/11.x/Illuminate/Support/Composer.html