André Roaldseth
Written by André Roaldseth
Published 2013-09-20

Avoid Dependency on 3rd Party Sources With Composer

Composer is the defacto standard dependency manager for PHP out there, also here in VG. We use it for not only our internal packages, but for all external packages like ZF2, Symfony, PHPUnit, etc. For the most parts it has been a pleasant experience, but it creates a hard dependency towards external sources as we now require these sources to be available when updating/installing.

Entry image

We deploy our code with Capistrano which uses Composer to install all dependencies for each release. This essentially means we will be unable to deploy our code if a 3rd party source is unavailable (I’m looking at you GitHub!).

Since we use Composer for all our internal packages, we already had Satis set up, which basically is a package repository builder for Composer.

Our basic Satis config looked like this:

We started adding all our external dependencies to Satis and turning on the archive function. Set up like this Satis will download local copies of all your external packages and mirror them for you.

In addition to setting up the archive feature you will also be needed to specify a new require block so that Satis can know which versions it has to have available from the external sources. Now we have a Satis configuration that looks like this:

Now we are no longer dependent on Github or any other external services being available and I feel Composer is able to install/update a lot faster now. Set up your own local Satis repository with the archive function today!

Written by André Roaldseth
Published 2013-09-20