Composer forCorporate Use

About me

Who of you has heard of Composer? Who uses it?
This is no intro to Composer...

Our story: Diversity

A lot of different project with a lot of technology stacks.

Back in the days: Subversion

Long time Subversion user, moved to Git about 3 years ago. Back in the SVN days we made heavy use of svn:externals to "manage" our dependencies.

No fixed dependencies

To be honest: We did not really deal with dependencies, we linked in some folders. That`s sth. completly different. I knew we had to change our strategy concerning dependency management. Composer was the only real option.

How can Composer help?

What are the everyday challenges we are dealing with?

Clear dependencies

just look into composer.json or composer.lock and you know what`s going on.

Run the licenses command
Jenkins Job as nightly build to check for issues

Perspective change

Composer changed the way I think about projects and their dependencies
I always try to ask the question if there`s functionality which we can reuse in multiple projects? If so, create a small, reusable package

Small problem domains

Choose the "perfect" toolset

Pick the libs that make the most sense for the project. Maybe a full-stack framework, maybe a microframework. Throw in Zend\Mail...
Install tools like PHPUnit, Phing locally within your project. These are dependencies just like Symfony or ZF

Build your own packages

Libs that take advantage of our infrastructure or the infrastructure of our customers
Pro-tip: Do not fork a project, remove the comments, change coding style and push it to packagist.org again.

Package design challenges

Mathias Noback: Principles of PHP Package Design

Composer Use-Cases

1. Simplify your project setup

Back in the subversion days it took quite a while to setup a project and configure svn:externals. With Composer this whole process is much smoother and can be done by any dev.

Custom project installer

Speeds up your project setup

One can not only create an installer for a framework but also to set-up a default project structure for your companies` projects incl. default dependencies and Vagrant/Puppet setup for a new project. Just a matter of running vagrant up and the virtual machine is up and running and the developers start to get their work done.

Customizing customers apps

We often build applications for our customers who sell these application to their customers, usually with customizations. To make things easier for the dev teams we create custom installers on a per project basis

Standardize package layout

Guide the devlopers to make it super easy to bootstrap a new library. Create a sample filesystem layout incl. the required dependencies, e.g. setup Sphinx for documentation, configure PHPUnit and PHPDocumentor...

2. Split app, maintain core lib

This is what drives a German really crazy ;)
Build one monolithic app, split it into several apps and share common functionality via a "core" package