Composer In Plugins

Notes

  • After adding new class:

    composer dumpautoload -o
    

How To Articles

Renaming Namespaces for Safety

WordPress has no concept of a shared library. If you’re using Composer packages also used in other plugins, your version may not be the one loaded. To work around this issue you can rename the package namespace.

These notes were done in winter 2020.

php-scoper

Mozart

Composes all dependencies as a package inside a WordPress plugin. Load packages through Composer and have them wrapped inside your own namespace.

Imposter

Composer plugin that wraps all composer vendor packages inside your own namespace. Intended for WordPress plugins.