roots/bedrock-autoloader
Bedrock Autoloader bridges Composer and Bedrock-based WordPress installs, letting plugins installed via Composer be autoloaded instead of manually managed, keeping dependencies declarative and deployments simpler.
composer require roots/bedrock-autoloader:^2.0. In a stock Bedrock project this is already a dependency, so composer update roots/bedrock-autoloader is usually the only install step.php -v locally, in CI, and on the host.config/. In Bedrock, look at web/app/mu-plugins/bedrock-autoloader.php first — it is the file you will almost certainly need to edit for 2.0.Roots\Bedrock\Autoloader\Autoloader (note the doubled Autoloader).new Autoloader(WPMU_PLUGIN_DIR).boot(), include the returned files yourself, then call markLoaded()."type": "wordpress-muplugin" (or configure installer-paths for web/app/mu-plugins/{$name}/) and let it load automatically. The autoloader is what makes nested mu-plugin directories work, since WordPress only auto-includes .php files at the root of mu-plugins/.web/app/mu-plugins/bedrock-autoloader.php as a thin entry point. Do not put logic in it beyond the guard, construction, loop, markLoaded(), and unset().class_exists(\Roots\Bedrock\Autoloader\Autoloader::class) — prevents a fatal if Composer's autoloader hasn't run or the package is missing (common in minimal/CI installs).is_blog_installed() — avoids running before WordPress is installed, which matters during wp core install, container boots, and migrations.boot() returns an array of file paths; the calling mu-plugin is responsible for include_once. If you need custom ordering or filtering, do it on that array before including — this is the cleanest extension point the package gives you.markLoaded(). Call it after the loop so the plugins table in wp-admin shows the asterisk that distinguishes autoloaded plugins from normal ones. Skip it and users lose the visual cue.WPMU_PLUGIN_DIR). Pass the same constant WordPress uses, or your plugins will be scanned from the wrong place.installer-paths; a typical entry looks like "web/app/mu-plugins/{$name}/": ["type:wordpress-muplugin"]. Add the package to require, run composer install, and rely on the loader rather than symlinks..php files at the mu-plugins root are still loaded by WordPress itself. Keep that split in mind when debugging "why isn't this loading".wp-config.php requires vendor/autoload.php before mu-plugins run. If you're wiring this up outside Bedrock, replicate that order or the class_exists guard will silently short-circuit.new \Roots\Bedrock\Autoloader(...) (v1.x) will fail the class_exists guard in 2.0 silently — no fatal, no log line, just plugins that mysteriously stop loading. Grep your codebase for the old namespace after upgrading.mu-plugins/bedrock-autoloader.php is still the 1.x file. If your Bedrock repo vendors that file, update it in the same commit; otherwise the new side-effect-free constructor signature will not be used and boot()/markLoaded() never fire.new Autoloader(...) time no longer happens. You must call boot() and markLoaded() explicitly.$file and $autoloader could leak into the included file. Don't write plugin code that depends on those variables — the fix removes them, and the trailing unset($autoloader, $file) in the reference snippet is there to keep the global scope tidy.markLoaded() is the only signal — make sure it works.vendor/autoload.php loads (class_exists returns true), confirm the path passed to the constructor is the real WPMU_PLUGIN_DIR, run wp plugin list to see whether entries appear, and check error_log for include_once warnings on missing files.2.0.0-beta.1 is not stable. Pin to the exact beta (or stay on 1.1.0) for production until 2.0.0 is tagged; expect the API surface to be settled but not guaranteed.boot() in your own mu-plugin wrapper rather than subclassing Autoloader.How can I help you explore Laravel packages today?