kaiseki / wp-cli-util
WP-CLI helpers: colorized output, logging, and timers.
1.0.0
2026-05-29 22:09 UTC
Requires
- php: ^8.2
Requires (Dev)
- 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
- roots/wordpress-core-installer: *
- roots/wordpress-no-content: @stable
- szepeviktor/phpstan-wordpress: ^2.0
- wp-cli/wp-cli-bundle: *
This package is auto-updated.
Last update: 2026-06-02 23:45:36 UTC
README
Small helpers for building WP-CLI commands: colorized output, structured logging, and timers.
Installation
composer require kaiseki/wp-cli-util
Requires PHP 8.2+ and a WP-CLI runtime (the classes call WP_CLI).
Components
Colorizer
Named wrappers around WP_CLI::colorize() — foreground colors, bright variants, backgrounds, and styles:
use Kaiseki\WordPress\WpCli\Util\Colorizer; $c = new Colorizer(); echo $c->toGreen('done'); echo $c->toRedBright('failed'); echo $c->toBackgroundYellow('note');
Logger
Formatted log lines (built on Colorizer) with colored, emoji-prefixed levels and optional indentation:
use Kaiseki\WordPress\WpCli\Util\Logger; $log = new Logger(new Colorizer()); $log->start('Importing posts'); $log->info('Found 120 items', indent: true); $log->success('Done'); $log->warning('Skipped 3'); $log->error('Could not connect');
Timer / TimerBuilder
Elapsed and per-interval timing with human-readable formatting:
use Kaiseki\WordPress\WpCli\Util\TimerBuilder; $timer = (new TimerBuilder())->make(); $timer->startTimer(); // … work … echo $timer->getElapsedTimeString(); // e.g. "1m 12s" $timer->addInterval(); // … more work … echo $timer->getIntervalTimeString(); // time since the last interval
Development
composer install
composer check # cs-check, phpstan
License
MIT — see LICENSE.