Better Site Stacks with Composer

Andrey “Rarst” Savchenko, WordCamp Europe 2013

Better Site Stacks
with Composer

Composer logo

Andrey “Rarst” Savchenko

Map

Composer — Dependency Manager

Utility to consume code in projects and conventions to publish code for it. In open, flexible, and robust manner.

getcomposer.org

Hobby — Profession

…a lot of professionals are running professional sites like they are still hobbyists.

Mark Jaquith #
Mark Jaquith

Version Control Isn’t Everything

F∗∗∗ing submodules.

Daniel Bachhuber #
Daniel Bachhuber

WordPress is
145K lines
PHP code

Namespaces PHP >= 5.3

			<?php
			namespace Rarst\Fragment_Cache;
			class Plugin extends \Pimple {
		

php.net/namespaces

PSR–0 Autoloading Standard

Requirements that must be adhered to for autoloader interoperability.

php-fig.org

Decoupled Frameworks

…community growth in the coming years will mainly come from the adoption of the components.

Fabien Potencier #
Symfony

Installation

curl -sS
 https://getcomposer.org/installer
 | php

WordPress Stack with Composer

composer create-project
 rarst/install-test
 --repository-url=https://www.rarst.net
 --stability dev
		

Sources

also PEAR and local archives

packages.json

Describes locations of packages.

composer.json

Contains information about package.

composer.lock

Captures precise state of project.

Dependencies

"require" : {
	"rarst/wordpress" : ">=3.6"
 }

Also `conflict` and `suggest`

Current Challenges

solidify your sites

own your code

Composer All the Things! Questions?

Rarst.net/slides/composer