2017 © Pedro Peláez
 

library phar-composer

Simple phar creation for your projects managed via composer

image

clue/phar-composer

Simple phar creation for your projects managed via composer

  • Sunday, November 15, 2015
  • by clue
  • Repository
  • 29 Watchers
  • 523 Stars
  • 9,708 Installations
  • PHP
  • 10 Dependents
  • 1 Suggesters
  • 41 Forks
  • 35 Open issues
  • 9 Versions
  • 5 % Grown

The README.md

clue/phar-composer

CI status downloads on GitHub installs on Packagist, (*1)

Simple phar creation for any project managed via Composer., (*2)

It takes your existing project's composer.json and builds an executable phar for your project among with its bundled dependencies., (*3)

  • Create a single executable phar archive, including its dependencies (i.e. vendor directory included)
  • Automated build process
  • Zero additional configuration

Table of contents, (*4)

Support us

We invest a lot of time developing, maintaining and updating our awesome open-source projects. You can help us sustain this high-quality of our work by becoming a sponsor on GitHub. Sponsors get numerous benefits in return, see our sponsoring page for details., (*5)

Let's take these projects to the next level together! 🚀, (*6)

Usage

Once clue/phar-composer is installed, you can use it via command line like this., (*7)

phar-composer

This tool supports several sub-commands. To get you started, you can now use the following simple command:, (*8)

$ phar-composer

This will actually execute the search command that allows you to interactively search and build any package listed on packagist (see below description of the search command for more details)., (*9)

phar-composer build

The build command can be used to build an executable single-file phar (php archive) for any project managed by composer:, (*10)

$ phar-composer build ~/path/to/your/project

The second argument can be pretty much everything that can be resolved to a valid project managed by composer. Besides creating phar archives for locally installed packages like above, you can also easily download and bundle packages from packagist.org like this:, (*11)

$ phar-composer build d11wtq/boris

The above will download and install the latest stable tagged release (if any). You can also specify a tagged version like this:, (*12)

$ phar-composer build clue/phar-composer:~1.0

Or you can specify to install the head of a given branch like this:, (*13)

$ phar-composer build clue/phar-composer:dev-master

A similar syntax can be used to clone a package from any git URL. This is particularly useful for private packages or temporary git clones not otherwise listed on packagist:, (*14)

$ phar-composer build https://github.com/composer/composer.git

The above will clone the repository and check out the default branch. Again, you can specify either a tag or branch name very similar to how composer works:, (*15)

$ phar-composer build https://github.com/composer/composer.git:dev-master

phar-composer install

The install command 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 build command, e.g.:, (*16)

$ phar-composer install phpunit/phpunit

After some (lengthy) build output, you should now be able to run it by just issuing:, (*17)

$ phpunit

In essence, the install command will basically just issue a build and then 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 sudo., (*18)

Windows limitation: Note that this subcommand is not available on Windows. Please use the build command and place Phar in your $PATH manually., (*19)

The search command 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:, (*20)

$ phar-composer search boris

It uses an interactive command line menu to ask you for the matching package name, its version and will then offer you to either build or install it., (*21)

Install

You can grab a copy of clue/phar-composer in either of the following ways., (*22)

This project aims to run on any platform and thus does not require any PHP extensions and supports running on legacy PHP 5.3 through current PHP 8+. It's highly recommended to use the latest supported PHP version for this project., (*23)

You can simply download a pre-compiled and ready-to-use version as a Phar to any directory. You can simply download the latest phar-composer.phar file from our releases page. The latest release can always be downloaded like this:, (*24)

$ curl -JOL https://clue.engineering/phar-composer-latest.phar

That's it already. Once downloaded, you can verify everything works by running this:, (*25)

$ cd ~/Downloads
$ php phar-composer.phar --version

The above usage examples assume you've installed phar-composer system-wide to your $PATH (recommended), so you have the following options:, (*26)

  1. Only use phar-composer locally and adjust the usage examples: So instead of running $ phar-composer --version, you have to type $ php phar-composer.phar --version., (*27)

  2. Use phar-composer's install command to install itself to your $PATH by running:, (*28)

    $ php phar-composer.phar install clue/phar-composer
    
  3. Or you can manually make the phar-composer.phar executable and move it to your $PATH by running:, (*29)

    $ chmod 755 phar-composer.phar
    $ sudo mv phar-composer.phar /usr/local/bin/phar-composer
    

If you have installed phar-composer system-wide, you can now verify everything works by running:, (*30)

$ phar-composer --version

There's no separate update procedure, simply download the latest release again and overwrite the existing phar., (*31)

Again, if you have already installed phar-composer system-wide, updating is as easy as running a self-installation like this:, (*32)

$ phar-composer install clue/phar-composer

Installation using Composer

Alternatively, you can also install phar-composer as part of your development dependencies. You will likely want to use the require-dev section to exclude phar-composer in your production environment., (*33)

You can either modify your composer.json manually or run the following command to include the latest tagged release:, (*34)

$ composer require --dev clue/phar-composer

Now you should be able to invoke the following command in your project root:, (*35)

$ 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., (*36)

To update to the latest release, just run composer update clue/graph-composer., (*37)

Development

clue/phar-composer is an open-source project and encourages everybody to participate in its development. You're interested in checking out how clue/phar-composer works under the hood and/or want to contribute to the development of clue/phar-composer? Then this section is for you!, (*38)

The recommended way to install clue/phar-composer is to clone (or download) this repository and use Composer to download its dependencies. Therefore you'll need PHP, Composer, git and curl installed. For example, on a recent Ubuntu/Debian-based system, simply run:, (*39)

$ sudo apt install php-cli git curl

$ git clone https://github.com/clue/phar-composer.git
$ cd phar-composer

$ curl -s https://getcomposer.org/installer | php
$ sudo mv composer.phar /usr/local/bin/composer

$ composer install

You can now verify everything works by running clue/phar-composer like this:, (*40)

$ php bin/phar-composer --version

If you want to distribute clue/phar-composer as a single standalone release file, you may compile the project into a single phar-composer.phar file like this:, (*41)

$ composer build

Note that compiling will temporarily install a copy of this project to the local build/ directory and install all non-development dependencies for distribution. This should only take a second or two if you've previously installed its dependencies already. The build script optionally accepts the version number (VERSION env) and an output file name or will otherwise try to look up the last release tag, such as phar-composer-1.0.0.phar., (*42)

You can now verify the resulting phar-composer.phar file works by running it like this:, (*43)

$ php phar-composer.phar --version

To update your development version to the latest version, just run this:, (*44)

$ git pull
$ composer install

Made some changes to your local development version?, (*45)

Make sure to let the world know! :shipit: We welcome PRs and would love to hear from you!, (*46)

Happy hacking!, (*47)

Tests

To run the test suite, you first need to clone this repo and then install all dependencies through Composer:, (*48)

$ composer install

To run the test suite, go to the project root and run:, (*49)

$ vendor/bin/phpunit

License

This project is released under the permissive MIT license., (*50)

This project bundles the StubGenerator and Extract classes with minor changes from the original herrera-io/box v1.6.1 licensed under MIT which no longer has an installable candidate. Copyright (c) 2013 Kevin Herrera., (*51)

Did you know that I offer custom development services and issuing invoices for sponsorships of releases and for contributions? Contact me (@clue) for details., (*52)

The Versions

15/11 2015

dev-master

9999999-dev https://github.com/clue/phar-composer

Simple phar creation for your projects managed via composer

  Sources   Download

MIT

The Requires

 

by Christian Lück

executable phar build process bundle dependencies

15/11 2015

v1.0.0

1.0.0.0 https://github.com/clue/phar-composer

Simple phar creation for your projects managed via composer

  Sources   Download

MIT

The Requires

 

by Christian Lück

executable phar build process bundle dependencies

10/07 2014

v0.5.0

0.5.0.0 https://github.com/clue/phar-composer

Simple phar creation for your projects managed via composer

  Sources   Download

MIT

The Requires

 

by Christian Lück

executable phar build process bundle dependencies

12/09 2013

v0.4.0

0.4.0.0 https://github.com/clue/phar-composer

Simple phar creation for your projects managed via composer

  Sources   Download

MIT

The Requires

 

executable phar build process bundle dependencies

21/08 2013

v0.3.0

0.3.0.0 https://github.com/clue/phar-composer

Simple phar creation for your projects managed via composer

  Sources   Download

MIT

The Requires

 

executable phar build process bundle dependencies

16/08 2013

v0.2.0

0.2.0.0 https://github.com/clue/phar-composer

Simple phar creation for your projects managed via composer

  Sources   Download

MIT

The Requires

 

executable phar build process bundle dependencies

12/08 2013

v0.1.0

0.1.0.0 https://github.com/clue/phar-composer

Simple phar creation for your projects managed via composer

  Sources   Download

MIT

The Requires

 

executable phar build process bundle dependencies

26/05 2013

v0.0.2

0.0.2.0 https://github.com/clue/phar-composer

Simple phar creation for your projects managed via composer

  Sources   Download

MIT

The Requires

 

executable phar build process bundle dependencies

18/05 2013

v0.0.1

0.0.1.0 https://github.com/clue/phar-composer

Simple phar creation for your projects managed via composer

  Sources   Download

MIT

The Requires

 

executable phar build process bundle dependencies