[pkg-php-pear] [Symfony (and more)] class loader in Composer packages
david at tilapin.org
Wed Apr 1 21:50:22 UTC 2015
Hi Daniel and all,
Ive recently been providing autoload.php files in the PHP (Composer)
packages Im currently maintaining (following Prach lead IIRC).
It mostly workarounds the lack of proper autoloader from Composer, and
allows one to load (statically) dependency classes without the need to use
something like the ClassLoader Element from Symfony (and thus fixed bugs
Static loaders should also be a performance improvement compared to
In order to do so, a simple phpab call is enough if no dependencies are
If some dependencies are involved, I also used a template to load them on
top of the actual class loader:
Id now like to (start to) do the same in Symfony now. The tricky part is
that, unlike the usual one-binary-per-source PHP package, making sure that
the autoload.php files are kept up to date (dependency-wise) will be a bit
more painful since there are a lot of composer.json files to check on
update (currently 42 packages in 2.6.6, and counting).
If you dont like it, please do object ASAP (so I wont lose too much time
on it for nothing ;). Ill start pushing the changes in a WIP branch so we
can review them before accepting them (and also not pollute master if we
end up aiming at another approach).
Please note that Composer is also pending in NEW, but I dont know yet how
we may integrate it to produce a proper system-wide classloader (via a
I can make it available in people.d.o if you want to
start playing with it and dont fancy rebuilding it yourself.
More information about the pkg-php-pear