Web Deployment With Composer

Traditionally, I’ve never depended on... well... dependency management. My projects have always been built in such a way, where updating various packages within one project was never really an issue.

Autoloading was never an issue either; I’ve always used PHP’s native SPL autoload register functionality to autoload classes, based on naming convention and namespacing. It is a simple solution that works phenomenally in most cases, but nowadays, packages that require Composer to compile an autoloader makes implementing vendor applications a little more exciting.

For certain web projects of mine, the deployment process now requires another side trip (after Grunt’s processing) to build the Composer autoloaders before being released to the web folder. In a recent project I developed, the project consists of SwiftMailer, Html2Pdf, and Smarty - all which require a Composer autoloader. Upon a web release, the script iterates through each of these vendor libraries and builds the respective autoloaders, which works in conjunction with the main, native SPL autoloaders.