When we build WordPress Plugins, we need to make sure none of our functions or classes have the same name as any of the other classes or functions from any of the other WordPress plugins installed on the site. How do we avoid this? PHP namespaces, that’s how.
In this video, I show how PHP namespaces and autoloaders can be used in WordPress plugins. I explain how the PSR-4 standard helps us name and organize our code. I use phpunit to show how it works.
🌲 My 2021 blog post about using PHP Namespaces:
🌲 My 2015 blog post about a talk I gave about using PHP Namespaces. with a link to the slides and video:
🌲 My 2015 blog post on Torque about using Composer and PHP Namespaces: