The PHP instance of Project-Level Composer.
This library allows you to install composer on your project making it possible for you to use composer even when it is not installed in the system. Moreover, You can consume the power of composer and its commands outside of the terminal as you normally do use any other PHP class.
require_once 'Path\To\Composer.php';
// $composer = new \abhishek6262\Composer\Composer('pathToProjectRoot', 'pathToBinDirectory');
$composer = new \abhishek6262\Composer\Composer(__DIR__);
if (! $composer->exists()) {
$composer->install();
}
if ($composer->packagesExists() && ! $composer->packagesInstalled()) {
$response = $composer->installPackages();
if ($response->statusCode() == '0') {
echo "Packages successfully installed.";
} else {
echo "Packages failed to install.";
}
print_r($response->output());
}
Please feel free to fork this package and contribute by submitting a pull request to enhance the functionalities. I will appreciate that a lot. Also please add your name to the credits.
Kindly follow me on twitter!
Moreover, To keep this and my other open source projects ongoing You can also support me on Patreon by clicking on the button below.
The MIT License (MIT). Please see License File for more information.