Adding Composer dependency management to WP CLI.
Adding Composer dependency management to WP CLI. Allows you to recursivly install/update composer packages inside of all of your WordPress plugins and themes.
This package uses a great piece of software called WP-CLI. It provides a command line interface for WordPress management. We are a plugin providing Composer management inside of WP CLI.
It’s the greatest thing to happen to the web since GIFs, Drop Shadows and dancing cats. Composer is a dead simple JSON-based dependency manager for PHP. For more information, check out http://getcomposer.org/.
No, not exactly! Sadly, I’m building this out and I’m trying to make some sweet WP-CLI and Composer integration. But for now, we only support a few command:
If you’d love to help out, please help! Make a pull request and let’s get coding!
Simple really! You just create a simple composer.json
file like you would with any Composer project. From there, wp-composer will interface with each plugin/theme that has composer support and it will generate the autoload files, too!
Just include something like this inside your main plugin file:
<?php
// Start the plugin...
require(__DIR__.'/vendor/autoload.php');
?>
It’s that simple.
It’s just Sean Fisher for now! We love the guys and gals from WP CLI too!
Simple! If you have WP CLI installed (you should), just run this command:
wp plugin install composer --activate
If not, you can just download it from clicking on the “ZIP” download button above. Just unzip the file and move it to wp-content/plugins/
. Everything should be located at wp-content/plugins/composer
!
After you install it, try running wp composer
and you should get a great interface to composer management inside of WP CLI.
GPLv2 or later
Pulling the ZIP from GitHub will not work on its own! You have to also setup the composer dependencies from this plugin for it to work. But luckily, there are other ways to skip this.
We love WP-CLI and it’s amazingly easy to install and activate the plugin with one command. From inside of your WordPress directory, run this command:
wp plugin install composer --activate
We highly reccomend using http://wpackagist.org/ to install this plugin. We love it and the guys and gals over at Outlandish Ideas cannot be thanked enough.
After setting up the new respository, you can add this to your composer.json
:
{
"require": {
"wpackagist/composer": "*"
}
}
Afterwards, you will of course have to activate the plugin.
I’ve added this package to the WordPress.org plugin listing for you to easily download it inside of WordPress Admin! When you download it from WordPress.org or from inside of your WordPress Admin, it will already be good to go and you don’t have to install the plugin at all. All that is needed is for you to activate the WordPress Composer
plugin.