kaiseki / wp-snicco-better-cli-commands
Register snicco/better-wp-cli commands with WP-CLI from a kaiseki/config container
Package info
github.com/kaisekidev/kaiseki-wp-snicco-better-cli-commands
pkg:composer/kaiseki/wp-snicco-better-cli-commands
Requires
- php: ^8.2
- kaiseki/config: ^2.0
- kaiseki/wp-hook: ^2.0
- psr/container: ^1.1 || ^2.0
- snicco/better-wp-cli: ^1.2
Requires (Dev)
- bnf/phpstan-psr-container: ^1.1
- kaiseki/php-coding-standard: ^1.0
- maglnet/composer-require-checker: ^4.0
- php-stubs/wordpress-stubs: ^6.2
- phpstan/extension-installer: ^1.4
- phpstan/phpstan: ^2.0
- phpstan/phpstan-phpunit: ^2.0
- phpstan/phpstan-strict-rules: ^2.0
- phpunit/phpunit: ^11.0
- roave/security-advisories: dev-latest
- szepeviktor/phpstan-wordpress: ^2.0
This package is auto-updated.
Last update: 2026-06-02 23:44:01 UTC
README
Register snicco/better-wp-cli commands with WP-CLI from a kaiseki/config container.
A single kaiseki/wp-hook HookProviderInterface (CommandRegistry) that, on the cli_init
action, builds a snicco/better-wp-cli WPCLIApplication from a configured list of command classes
and registers them with WP-CLI. Command classes are resolved lazily from the PSR-11 container, so each
command's own dependencies are wired by the container.
Installation
composer require kaiseki/wp-snicco-better-cli-commands
Requires PHP 8.2 or newer.
Usage
Register ConfigProvider with your laminas-style config aggregator. It registers the
CommandRegistry hook provider and a CommandRegistryFactory, and seeds the
snicco_better_cli_commands config with an empty command list and the kaiseki namespace.
Configure your commands and (optionally) the WP-CLI namespace, then activate the provider via
kaiseki/wp-hook:
use Kaiseki\WordPress\SniccoBetterCliCommands\CommandRegistry; use My\App\Cli\GreetCommand; // extends Snicco\Component\BetterWPCLI\Command return [ 'snicco_better_cli_commands' => [ 'commands' => [ GreetCommand::class, // list of Snicco BetterWPCLI Command class-strings ], 'namespace' => 'my-app', // WP-CLI namespace; defaults to 'kaiseki' ], 'hook' => [ 'provider' => [ CommandRegistry::class, ], ], ];
Each command class must extend Snicco\Component\BetterWPCLI\Command and be resolvable from the
container. Non-string entries, and strings that are not Command subclasses, are ignored.
Development
composer install
composer check # check-deps, cs-check, phpstan
License
MIT — see LICENSE.