Awesome
WordPress Composer Installer
Note: This is extremely work in progress. Do not attempt to run any of this in production environment, unless you are the adventurous type. :)
Install and usage
- Install dependencies of this plugin first, by running
composer install
. - Activate the plugin in your WordPress install.
- Copy the
sample-plugins-composer.json
file and rename it toplugins-composer.json
. Add paths to thecomposer.json
files you want to install the dependencies of. (This step will be automated in #3). - Click on the
Composer install
plugin action link in the Plugins screen. This will install the dependencies required for merging thecomposer.json
files. - Delete the now generated
plugins-composer.lock
file (This step will be automated in #2). - Click on the
Composer install
plugin action link again, in the Plugins screen. This will install the dependencies of the plugins specified in theplugins-composer.json
file. - The dependencies will now be installed in the
wp-content/vendor/
directory. You can include the autoloader atwp-content/vendor/autoload.php
.
Important bits during development
- Process is really expensive and takes a long time. Probably need to put some kind of wizard, progress bar or whatever and make sure it doesn't time out.
- Of course the plugin needs to be structured properly, this is only a proof of concept for now.
- It needs to hook in on plugin activate/deactivate and do its magic there. Manual option to override.
- Ryan McCue has provided a ton of great UI/UX things to look after in code like this: "How I Would Solve Plugin Dependencies"