8. Why Composer?
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.
9. 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:)
10. In Scope
● Discuss Structure For A Plugin With
Composer
● Talk About The Autoloader
● Make An Example Plugin
● Worry About How To Ship It
● Get Some Helpful Links
● Take Questions
12. ● How much is in the plugin vs separate
packages?
● Are we using the autoloader?
○ For the dependencies only or for the whole plugin?
● What 3rd party packages are we using?
● What about tests?
Questions
15. include_once( dirname( __FILE__ ) . '/vendor/autoload.php' );
Composer Autoloader: Fun Facts
● PSR-4, PSR-0, classmap, filemap
● Can be used for:
○ Dependencies
○ The package's classes
■ ^^ Means you can use it as the
autoloader for your plugin.
16. Autoloaders Are Important!
● Less work/room for errors when adding
classes.
● Less barriers to making a new class ==
smaller classes
○ More maintainable
○ More reusable
○ More likely to abide by the single responsibility
principle
24. ● Dependencies need to get to WordPress.org
SVN
○ Can't I just commit my dependencies in the real
repo?
○ Or automate it with grunt or bash?
● What about when someone checks out from
Github?
Concerns
25. More Examples
● 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
26. Helpful Links
● 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