Simple phar creation for any project managed via composer.
It takes your existing project's
composer.jsonand builds an executable phar for your project among with its bundled dependencies.
- Create a single executable phar archive, including its dependencies (i.e. vendor directory included)
- Automated build process
- Zero additional configuration
searchcommand that allows you to interactively search and build any package listed on packagist (see below description of the search command for more details).
buildcommand can be used to build an executable single-file phar (php archive) for any project managed by composer:
$ phar-composer build ~/path/to/your/project
$ phar-composer build d11wtq/boris
$ phar-composer build clue/phar-composer:~1.0
$ phar-composer build clue/phar-composer:dev-master
$ phar-composer build https://github.com/composer/composer.git
$ phar-composer build https://github.com/composer/composer.git:dev-master
installcommand will both build the given package and then install it into the system-wide bin directory
/usr/local/bin(usually already in your
$PATH). This works for any package name or URL just like with the
$ phar-composer install phpunit/phpunit
In essence, the
installcommand will basically just issue a
sudo mv $target.phar /usr/local/bin/$target. It will ask you for your sudo password when necessary, so it's not needed (and in fact not recommended) to run the whole comamnd via
searchcommand provides an interactive command line search. It will ask for the package name and issue an search via packagist.org's API and present a list of matching packages. So if you don't know the exact package name, you can use the following command:
$ phar-composer search boris
phar-composer.pharfile from our releases page:
That's it already. You can now verify everything works by running this:
$ cd ~/Downloads $ php phar-composer.phar --version
- Only use phar-composer locally and adjust the usage examples: So instead of
$ phar-composer --version, you have to type
$ php phar-composer.phar --version.
- Use phar-composer's
installcommand to install itself to your $PATH by running:
$ php phar-composer.phar install clue/phar-composer
- Or you can manually make the
phar-composer.pharexecutable and move it to your $PATH by running:
$ chmod 755 phar-composer.phar $ sudo mv phar-composer.phar /usr/local/bin/phar-composer
$ phar-composer --version
updateprocedure, simply download the latest release again and overwrite the existing phar.
Again, if you have already installed phar-composer system-wide, this is as easy as running a self-installation like this:
$ phar-composer install clue/phar-composer
require-devsection to exclude phar-composer in your production environment.
You can either modify your
composer.jsonmanually or run the following command to include the latest tagged release:
$ composer require --dev clue/phar-composer
$ ./vendor/bin/phar-composer --version
Note: You should only invoke and rely on the main phar-composer bin file. Installing this project as a non-dev dependency in order to use its source code as a library is not supported.
composer update clue/phar-composerto update to the latest release.
$ git clone https://github.com/clue/phar-composer.git $ cd phar-composer $ curl -s https://getcomposer.org/installer | php $ php composer.phar install
$ php bin/phar-composer --version
phar-composer.pharyourself by issuing:
$ php bin/phar-composer build
$ git pull $ php composer.phar install