To answer some of your questions:
- Composer does not install .phar files as the dependencies. In fact, those common packages that do come as .phar file (namely PHPUnit) do offer .phar as an alternative to using Composer, which is mutually exclusive. So you'd simply run
composer install
, get a directory tree of your own files and vendor files, and can then add these all into the .phar file you are about to create. - Composer autoloader does use
__DIR__
to know where it is, and where other files are relative from this constant. This should be compatible with .phar files. - You have to install Composer on the machine you intend to create the .phar files on.
- Filtering unwanted files is the task of your build script that creates the .phar files. It is not the task of Composer.
Note that there are already libraries that help you creating .phar files. Have a look at kherge/box, for example.