new3den/console
Composer 安装命令:
composer require new3den/console
包简介
Console library
README 文档
README
Requirements
- PSR-11 compatible container
- PHP8.0 or higher
bin/console example
<?php declare(strict_types=1); $autoloaderPath = __DIR__ . '/../vendor/autoload.php'; if(!file_exists($autoloaderPath)) { throw new RuntimeException('Error, composer is not setup correctly.. Please run composer install'); } $autoloader = require $autoloaderPath; # Container $container = new \League\Container\Container(); # Autowiring $container->delegate(new \League\Container\ReflectionContainer()); # Load the CLI $cli = new \New3den\Console\Console($container, $autoloader); # Define the class scope to load commands from $cli->setCommandsNamespace('New3den\\Commands'); # Define the name $cli->setConsoleName('New3den'); # Define the version $cli->setVersion('1.0.0'); # Run the cli $cli->run();
Command example
<?php declare(strict_types=1); namespace New3den\Commands; /** * @property string $stringInput */ class Command extends \New3den\Console\ConsoleCommand { protected string $signature = 'command {--stringInput=Hello World : Some string to pass into the command }'; protected string $description = 'This is an example command'; public function handle(): void { $this->out($this->stringInput); } }
统计信息
- 总下载量: 77
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-03-04