Registering CLI Commands - 3ev/wordpress-core GitHub Wiki
Wordpress Core provides out-of-the-box support for creating custom WP CLI commands.
###The config file
Your plugin's custom CLI commands should all be registered in the config/commands.php PHP file inside your plugin's root folder. This file should return a simple PHP hash, with each key being a command identifier and each value being the fully-qualified classname of a command class.
For example:
<?php
return array(
'my-command' => 'MyPluginVendor\Command\MyCommand'
);
If a consumer doesn't have WP CLI installed, don't worry. Wordpress Core will only attempt to register commands if the library is available.
###Creating custom commands
For more information on creating custom WP CLI commands, see the Commands Cookbook in the WP CLI documentation.