new3den / console
Console library
1.0.0
2021-01-24 15:18 UTC
Requires
- php: >=8.0
- jolicode/jolinotif: ^2.2
- psr/container: *
- psy/psysh: ^0.10
- symfony/console: ^5.2
Requires (Dev)
- roave/security-advisories: dev-master
- symfony/var-dumper: ^5.2
This package is not auto-updated.
Last update: 2024-11-17 06:17:16 UTC
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); } }