Better Site Stacks with Composer

A presentation at WordCamp Europe 2013 in October 2013 in Leiden, Netherlands by Andrey Savchenko

Slide 1

Slide 1

Better Site Stacks with Composer

Slide 2

Slide 2

2 Andrey “Rarst” Savchenko • Rarst.net ♦ WPSE ( s.tk/wp ) • QueryPosts.com • Composer.Rarst.net

Slide 3

Slide 3

3 Composer — Dependency Manager Utility to consume code in projects and conventions to publish code for it. In open, flexible, and robust manner. getcomposer.org

Slide 4

Slide 4

4 “ Hobby — Profession …a lot of professionals are running professional sites like they are still hobbyists. Mark Jaquith #

Slide 5

Slide 5

5 “ Version Control Isn’t Everything F∗∗∗ing submodules. Daniel Bachhuber #

Slide 6

Slide 6

WordPress is 145K lines PHP code

Slide 7

Slide 7

7 Namespaces PHP >= 5.3 01. <?php 02. namespace Rarst\Fragment_Cache ; 03. class Plugin extends \Pimple { php.net/namespaces

Slide 8

Slide 8

8 PSR–0 Autoloading Standard Requirements that must be adhered to for autoloader interoperability. php-fig.org

Slide 9

Slide 9

9 “ Decoupled Frameworks …community growth in the coming years will mainly come from the adoption of the components. Fabien Potencier #

Slide 10

Slide 10

10 Installation • getcomposer.org/composer.phar • getcomposer.org/Composer-Setup.exe curl -sS https://getcomposer.org/installer | php

Slide 11

Slide 11

11 WordPress Stack with Composer composer create-project rarst/install-test --repository-url= http://rarst.net

Slide 12

Slide 12

12 Sources • direct downloads • Subversion • Git (+ GitHub downloads) • Mercurial (+ Bitbucket downloads) also PEAR and local archives

Slide 13

Slide 13

13 packages.json Describes locations of packages. • Packagist.org • Satis ( github.com/composer/satis )

Slide 14

Slide 14

14 composer.json Contains information about package. composer.lock Captures precise state of project.

Slide 15

Slide 15

15 Dependencies "require" : { "rarst/wordpress" : ">=3.6" } Also conflict and suggest

Slide 16

Slide 16

16 Current Challenges • bridge to core • access to repositories • asset management

Slide 17

Slide 17

solidify your sites

Slide 18

Slide 18

own your code

Slide 19

Slide 19

19 Composer All the Things! Questions? • @Rarst • The Loop ( s.tk/chat ) Rarst.net/slides/composer