It facilitates sharing your code & other's code.
● It's easy.
● It uses VCS, just like you're used to.
● It's a standard, works well with standards.
● Has WordPress support backed-in.
Out Of Scope For Today
● Installing Composer
○ Read https://getcomposer.org/doc/00-intro.md
○ Make sure to install globally
● Composer Basics
● Composer In Core
● Composer For Theme Development
● Composer For Full Stack Management
○ I probably can't resist this one:)
● Discuss Structure For A Plugin With
● Talk About The Autoloader
● Make An Example Plugin
● Worry About How To Ship It
● Get Some Helpful Links
● Take Questions
● How much is in the plugin vs separate
● Are we using the autoloader?
○ For the dependencies only or for the whole plugin?
● What 3rd party packages are we using?
● What about tests?
include_once( dirname( __FILE__ ) . '/vendor/autoload.php' );
Composer Autoloader: Fun Facts
● PSR-4, PSR-0, classmap, filemap
● Can be used for:
○ The package's classes
■ ^^ Means you can use it as the
autoloader for your plugin.
Autoloaders Are Important!
● Less work/room for errors when adding
● Less barriers to making a new class ==
○ More maintainable
○ More reusable
○ More likely to abide by the single responsibility
● Dependencies need to get to WordPress.org
○ Can't I just commit my dependencies in the real
○ Or automate it with grunt or bash?
● What about when someone checks out from
● Caldera Metaplate
○ Almost totally Composer Packages
○ Grunt script for shipping to WordPress.org
● Rarst's Fragment Cache
○ Uses Jaquith's tlc-transients package
○ Only on Github
● WordPress SEO by Yoast
○ Check out how they use scripts in composer.json
● The Docs
● My Torque Articles
○ Introduction To Composer For WordPress
○ Introduction To Plugin Dev With Composer
○ Namespace & Autoloaders
● Rarst's Composer + WordPress
● Micah Wood's Composer Talk @ LoopConf