Orchestrating PHP Dependencies with Composer and IronWorker

Package your dependencies on IronWorker using composer

Overview

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.

 

Table of Contents

Related Reading: Top 10 uses of IronWorker

Achieve Cloud Elasticity with Iron

Speak to us to find how you can achieve cloud elasticity with a serverless messaging queue and background task solution with free handheld support.

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

It's nearly as simple to do the same in 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>

 

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

 

BOOM! it's that simple! Your packages will be built on our servers and accessible via your script.

Iron.io Serverless Tools

Speak to us to learn how IronWorker and IronMQ are essential products for your application to become cloud elastic.

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!

blank
blank

 

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

blank

 

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 even feature tutorials written by you! send me a message at stephen@iron.io.

Unlock the Cloud with Iron.io

Find out how IronWorker and IronMQ can help your application obtain the cloud with fanatical customer support, reliable performance, and competitive pricing.

Leave a Comment





This site uses Akismet to reduce spam. Learn how your comment data is processed.