Search code examples
phpcomposer-phpphar

PHP PHARs with composer?


I've been thinking of advantages and disadvantages of distributing my app as a single PHAR.

I'd still like to use Composer to manage all the random dependencies I have, though. This means writing back to the phar if stuff changes, which I understand is at best a convoluted process.

What's the best way of reconciling that? Should I simply keep my app self-contained and have it work with an external /vendor dir?

Thanks in advance!


Solution

  • Considering that the composer.phar file itself includes a few Symfony components, as well as some other libraries written by the author, and they are all put into the .phar file for distribution (including, explicitly, a number of vendor/ sub-directories), it doesn't seem unreasonable to also include the required vendor directories for your own project.