Download the PHP package idearia/wp-cli-command without Composer
On this page you can find all versions of the php package idearia/wp-cli-command. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download idearia/wp-cli-command
More information about idearia/wp-cli-command
Files in idearia/wp-cli-command
Download idearia/wp-cli-command
More information about idearia/wp-cli-command
Files in idearia/wp-cli-command
Vendor idearia
Package wp-cli-command
Short Description Simple class to create WP-CLI commands with validation with little effort.
License MIT
Homepage https://github.com/Idearia/wp-cli-command
Package wp-cli-command
Short Description Simple class to create WP-CLI commands with validation with little effort.
License MIT
Homepage https://github.com/Idearia/wp-cli-command
Please rate this library. Is it a good library?
Informations about the package wp-cli-command
Simple class to create WP-CLI commands with validation with little effort.
Features
- Create a WP CLI command by extending a simple class
- Easily hook into the command lifecycle by extending methods
before_run_command
,before_invoke
,after_invoke
- Advanced validation by extending method
validate
- Support for sub-commands by defining public methods
- Support for PHPDoc validation
Quick start
-
Require
wp-cli-command
in your project: - Create a new command by extending the
Command
class. How? Have a look at the examples folder 🙂 - Register your command with
MyCommand::init( 'my-command' );
- Run the command with
wp my-command
.
Available hooks
In oder of execution:
before_run_command
> Just before the command is found and executedbefore_invoke
> Just before a command is invokedafter_invoke
> Just after a command is invoked
Example
- A simple command from WP-CLI docs with an additional layer of validation: examples/SimpleCommand.php
- An example with two sub-commands, each with its own validation > TODO!
To do
- Make hook methods aware of the specific command being executed, in case the class contains more than one. Probably, we will need to switch away from static, in order to save $args in the class.
- Behat tests with
wp scaffold package
- Example with subcommands
- Find a way to execute PHPDoc validation before custom validation (maybe invoking the command and the exiting with
before_invoke:{$cmd}
)? - Find a way to print actual usage, instead of relying on $usage property (how to force show_usage in subcommand.php)?
All versions of wp-cli-command with dependencies
PHP Build Version
Package Version
Requires
php Version
^8.1
The package idearia/wp-cli-command contains the following files
Loading the files please wait ....