Considerations & Concerns for Platform Plugin Development
One of the major strengths of WordPress is the ability to develop small plugins to solve particular needs. Whether you want to re-arrange menus or add a new dashboard widget, WordPress gives you the tools to make small, focused plugins to customize nearly anything.
This paradigm changes when your code is running across tens of thousands of customer sites, however. Suddenly, you have to coordinate which features are active based on the site. Is this a WooCommerce site? Does this feature exist in this version of WordPress? Has the site owner already installed another plugin to handle this piece of functionality?
In this session, we'll be taking a deep dive into the architecture, development decisions, and release process behind the "Must-Use" (MU) plugin that runs on every WordPress site across the Nexcess Managed Applications platform. Attendees will learn about the practice and challenges of building a WordPress plugin at-scale, as well as how to better handle conflicts in their own plugins of any size.
- WordSesh 2021 — May 26, 2021 (PDF)
- WordCamp Northeast Ohio Region (NEO) 2021 — May 23, 2021 (Video, PDF)
The following resources expand upon some of the topics we could barely touch upon in this talk.
PHP Namespaces and Autoloading
- A Crash-course in PHP Namespaces for WordPress Developers
- Alternatively, you may prefer the slides for the talk of the same name
- PHP Manual entry on Autoloading
- PSR-4: Autoloader — Official specification for PSR-4
- Composer autoloader reference
- Dependency Injection in PHP — A great introduction to dependency injection in PHP by @sarfraznawaz2005
- PSR-11: Container Interface — Official specification for PSR-11
- Dependency Injection v Service Location — Explains the differences between actual Dependency Injection and the Service Locater pattern
Testing and Software Quality
- Writing WP-CLI Commands That Work!
- Confidently Testing WordPress
- Build and Release Confidently with Continuous Integration and Delivery
- Code Review: For Me & You
- Performance Optimisation: How do I go about it? — Excellent introduction to performance optimization by @katzien (slides)
Referenced tools and libraries
- PHP_CodeSniffer — Coding standards
- PHP Compatibility — PHP_CodeSniffer ruleset for checking compatibility across PHP versions
- cweagans/composer-patches — Composer plugin for patching Composer dependencies
- PHP Coding Standards Fixer — Alternative coding standards checker for PHP
- PHPStan — Static code analysis
- WordPress extensions for PHPStan by @szepeviktor
- Symfony's PHPUnit Bridge component — Run your test suite across multiple versions of PHPUnit
- Interworx — Hosting software used to expose environment details to the MU plugin
- Currently supported versions of PHP
- What Is Garbage Collection in PHP And How Do You Make The Most Of It?