Orchestrating PHP Dependencies with Composer and IronWorker

Package your dependencies on IronWorker using composer

 

This is a tutorial describing how to include and use the PHP package management tool Composer with IronWorker.

Composer is a tool for dependency management in PHP. It allows you to declare the dependent libraries your project needs, and it will install them in your project for you. Packagist is the main Composer repository. It aggregates all sorts of PHP packages that are installable with Composer.

Installing Using Composer locally

1. run  composer install command (this downloads composer.phar file locally)

$ curl -s https://getcomposer.org/installer | php

2. define packages and versions in a composer.json file

{
    "require": {
        "vendor/package": "1.3.2",
        "vendor/package2": "1.*",
        "vendor/package3": ">=2.0.3"
    }
}

3. run the installation command

$ php composer.phar install

4. your packages will be installed in a /vender folder locally and can be loaded in your php script via

require 'vendor/autoload.php';

Using Composer on IronWorker

Its nearly as simple to do the same in a IronWorker.

1. include both the local compser.phar and composer.json in your .worker manifest. Also include a build script for us to run on our servers.

runtime "php"

file "composer.phar"
file "composer.json"
build "php composer.phar install"

exec "my_script.php

2. upload via our command line tool

$ ironworker upload <name_of_workerfile>


This is what you will see when running “iron_worker upload test.worker

 

BOOM! its that simple! Your packages will be built on our servers and accessible via to your script.

Composer growth!

With 38,464 packages registered and close to 35,000,000 packages installed each month, it is quickly becoming the standard in PHP package management by popular frameworks such as LaravelSymfonyYiiZend, and more. We also heard recently that EngineYard a leader in application management is sponsoring Composer with a 15,000 community grant!

 

We are excited to see the growth that Composer has received thus far, and are look forward to seeing our own users take advantage of this wonderful tool and the IronWorker platform together.

Bonus: VersionScout.co

Props go out to Van der Stock, an awesome fan of IronWorker is actually using IronWorker to relay updates to users when their composer dependencies are out of date! Get updates when your Composer dependencies are out of date! send him regards at @dietervds

 
More flexibility for our developers

Making deployment and dependency management painless is a top priority for our team. Supporting a diverse range of languages, frameworks, and packages provides our users what they need to make their Iron.io implementation successful.

We’d love to hear feedback or to even feature tutorials written by you! send me a message at: stephen@iron.io.