mateodioev/php-easy-cli

创建命令行应用程序

v2.0 2023-02-12 19:38 UTC

This package is auto-updated.

Last update: 2024-09-12 23:00:03 UTC


README

安装

composer require mateodioev/php-easy-cli

使用

use Mateodioev\PhpEasyCli\{App, Color, Context, Printer};

$app = new App($argv);

$app->register('help', function(Context $ctx, Printer $printer) {
    $printer->display('Default command is help!!');
});

$app->register('hello', function(Context $ctx, Printer $printer) {
    $printer->display('Hello ' . $ctx->get('name', true, 'User name'));
});

$app->run();
php script.php hello --name=Mateo