chrisboulton/php-resque — pull request #128 by danhunsaker (2013-08-26 23:32:38+00:00)
Title: Composer fallback

A great deal of projects that we've started recently have been perfect for PHP-Resque, but terrible for Composer. The trouble with Composer is that our deployments are largely automated, and while we can make use of the Composer installer and even git submodules in this environment, in practice both are riddled with unreliability. Specifically, submodules rely on the external repos being available and willing to serve a clone to our deployment servers - and Composer is much the same. GitHub in particular is an especial headache since Composer (stupidly, IMO) uses the GitHub API instead of one of git's builtin protocols, which results in GitHub constantly throttling our hosting provider, and by extension, all of our deploys. And when GitHub decides to go down, the problems only get worse.

So, in order to compensate for this trouble we keep having, we end up writing our own autoloader(s) to pull in not only PHP-Resque, but all of its dependencies as well. This isn't a terrible thing, but it would be nice to simply pull up the project and include the appropriate setup script(s). While we could certainly maintain such scripts independently of PHP-Resque itself - and indeed have been - we suspect that others are in a similar situation where Composer simply doesn't make sense for our development and deployment environments. We feel it would be nice to have a fallback mechanism which would attempt to autoload Resque and its dependencies without relying on the use of yet another external tool, even one so useful as Composer.

This isn't necessarily the most complete solution, and indeed I welcome feedback on where it could be improved further. For example, it might be useful to add the standard PHP include path(s) to the list of places to look, if anyone actually uses those. A more streamlined and flexible approach to passing autoloader paths might be nice, too, though I'd prefer to leave specifics until after more discussion on the matter. In the meantime, this is a functional approach that doesn't sacrifice either the flexibility and power of Composer, or the similar benefits of not relying on Composer too heavily. If nothing else, perhaps this PR will serve as a good starting point for those wishing to use PHP-Resque without Composer despite the changes not being accepted upstream.