Download the PHP package boxuk/wp-muplugin-loader without Composer

On this page you can find all versions of the php package boxuk/wp-muplugin-loader. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package wp-muplugin-loader

WP Must-Use Plugin Loader

Build Status

Attribution

Overview

Managing plugins using the Composer Installers library works remarkably well. However, its handling of MU plugins leaves something to be desired.

WordPress MU (must use) Plugins are files that are placed in the wp-content/mu-plugins/ folder. These files are loaded automatically. The problem is when a plugin is actually inside a folder. WordPress will only load .php files and doesn't drop into any directories. When the Composer Installers plugin runs, it always puts the repo into a nice contained folder. This means the Composer Installers MU plugins never actually run!

There are manual ways around this that work fine, but I want to get away from any manual steps when running the install. No extra files, just run composer install or composer update and have it work. That is what the WP Must-Use Plugin Loader does.

Usage Instructions

In your project's composer.json file, require this package.

Make sure in the extras of your composer.json you have your mu-plugins path defined.

And that's it.

When Composer dumps it's autoload file, a file called mu-require.php will be placed into your mu-plugins folder. When WordPress loads this file as an MU plugin, it will find all of the plugins in folders in your MU plugins directory and include those as well.

Changing the name of the generated file

If you need to have control over what the name of the generated file is, you can set it with the following within the extra section of your composer.json:

Similarly, if you wish to turn off generation of this file altogether you can do so by setting this to false:

Forcing MU Plugins

Usually when you are using MU plugins, you have some 'normal' WordPress plugins that you want to always be active. They are not always MU-Plugins, though, so it makes no sense to put the "type": "wordpress-muplugin" in the composer.json file. WP Must-Use Plugin Loader allows you to override the type from wordpress-plugin to wordpress-muplugin as needed.

To do this, define a "force-mu" key in "extra" of your composer.json file. This key should hold an array of slugs for plugins to force into Must-Use status.

This is compatible with WPackagist. When adding plugins from WPackagist use the plugin's normal slug, not the wp-packagist version.

When the rest-api plugin is installed, instead of going in the normal plugins folder, it will be pushed over to the mu-plugins folder and loaded automatically with other Must-Use Plugins.

Forcing Unix Directory Separators

If you work on Windows but use a Linux VM to run your development server, you may need to force unix directory separators to make sure the server can find the mu loader script. If so, there's another configuration in the extra block you can set:

Modifying the src directory of the mu plugins

You may wish to change the src directory you want the mu plugins to be loaded from. For example, on WordPress VIP projects you may wish to load mu plugins from client-mu-plugins using this loader. To do this you can set a constant to tell the mu plugin loader where your mu plugins are kept:

Filtering the mu plugins loaded

You may wish to filer the mu plugins loaded by the mu plugin loader. WordPress does not provide any hook that is early enough to ensure that this filter is registered before the plugins are loaded, so filtering of this list should be applied immediately before the mu-loader is initialised. You can modify the mu-require.php file like the below, or create a new file that's alphabetically before mu-require.php file in your mu-plugins directory.


All versions of wp-muplugin-loader with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4 || ^8.0 || ^8.1 || ^8.2
composer-plugin-api Version ^1.0 || ^2.0
ext-json Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package boxuk/wp-muplugin-loader contains the following files

Loading the files please wait ....