This talk is based on the hypothesis that reusable code is better code. We’ll learn how to use Composer – the PHP dependency manager – in WordPress plugin development to facilitate sharing code between projects.
If you’ve been creating WordPress plugins for any amount of time odds are pretty high that you’ve encountered reusing code between projects, both while building and maintaining your code. Composer is a tool that has been designed to help reduce and, in some cases, eliminate this friction.
In this session, Josh Pollock teaches us how using Composer within our WordPress Plugins can not only help us share useful code between our projects, and use other people’s code, but how it can lead to more modern development practices in our plugins. Composer’s autoloader, one of its most useful features, is an easy way to start writing smaller, more maintainable classes.
We will cover how to move repetitive patterns and classes you use in all of your plugins into Composer packages. This will promote easy sharing between plugins of code. More importantly, it makes sharing bug fixes and improvements in one plugin to all of your plugins. Also, we will cover how to intelligently use other people’s code in your plugins, with an easy way to track upstream changes and challenges in distributing WordPress plugins that use composer.