Skip to content

abhishek6262/Composer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Composer

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.

Read Blog Post.

Examples

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());
}

Credits

Contributing

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!

Support

Moreover, To keep this and my other open source projects ongoing You can also support me on Patreon by clicking on the button below.

License

The MIT License (MIT). Please see License File for more information.