Here are some updates on my chef resource for composer:

It started off with a PR where I was asked to include code that would download (and install) a composer.phar if none existed. Not a bad idea in general, but also not something I want to impose on anyone, so I decided to create a new action (or in chef-lingo goal) instead.

setup

Up until now, my php_composer resource supported :install which runs php composer.phar install when a composer.phar is in the designated directory:

Since an hour or so ago, it also supports :setup. And :setup will download composer for you if requested:

Note: I’m not sure if this is a good idea for a couple of reasons — the most obvious one: getcomposer.org could be unavailable when you run your deployment. And then there may or may not be changes in the latest composer.phar which require you to make adjustments to your local composer.json. I prefer my deployments rock-solid to minimize side-effects! :)

Getting started

My resource will use composer but it’s generally a chef-no-no to also install the tools required by the resource.

A small list of items you will need:

  • php 5.3+
  • the Phar extension
  • git-core (and/or subversion)
  • unzip (or PHP’s zip extension)

For an idea how to set these up with chef, see my vagrant-test::default recipe.

Roadmap

I haven’t really decided on a roadmap, but here are a few things I want to implement in the coming weeks:

  • If you’re feeling frisky: support for php composer.phar self-update.
  • Support for php composer.phar update!
  • An attribute to provide the location of a phar (e.g. local or network file-system, CDN, etc.).
  • Support for --install-dir.

I’m open to contributions on any of these items, my requirements are:

  • Code must be robust.
  • Code must be robust.
  • Your additions should work on Ubuntu and Linux in general. :)

Fin

That’s all. Check it out on Github!