Jordi Boggiano
@seldaek


Composer in 2016

State of the ecosystem

Packagist Stats

Started April 2011 (5 years!)

~400K visits / month

~200K unique visitors / month

100K packages

2.4 billion installs since April 2012

PHP Versions

PHP Requirements

                    5.2   2.51%
                    5.3   45.26%
                    5.4   31.69%
                    5.5   15.48%
                    5.6   3.52%
                    7.0   1.54%
                

Deploying best practices

Define your production environment

{
    "config": {
        "platform": {
            "php": "5.6.4",
            "ext-mongo": "1.0.0"
        }
    }
}
                

Commit the lock file

git add composer.lock && git commit
                

Install trusted dependencies

composer install --optimize-autoloader --no-suggest --no-progress
composer install --optimize-autoloader --quiet
                

New / Less-known Features

Why/why-not

Outdated command

Editing packages you own

Define proper installation method

{
    "config": {
        "preferred-install": {
            "nelmio/*": "source",
            "*": "dist"
        }
    },
    "require": {
        "nelmio/foo": "^1.2",
        "other/package": "^1.4"
    }
}
                

Path Repository / Monorepo

Multiple private packages

Dynamic workflow

Lots of updates

Path Repository / Monorepo

repo/projectA/composer.json

{
    "repositories": [
        {"type": "path", "url": "../core"}
    ],
    "require": {
        "vendor/core": "dev-master"
    }
}
                

repo/core/composer.json

{
    "name": "vendor/core",
    "version": "dev-master"
}
                

Latency in Japan :(

https://github.com/hirak/prestissimo

https://packagist.jp/

ありがと

@seldaek

slides.seld.be

Questions? :)