sepiphy / console
Extend Symfony Console within a few utilities
v0.11.0
2021-04-06 03:23 UTC
Requires
- php: >=7.4
- psr/container: ^1.0
- sepiphy/container: ^0.11.0
- symfony/console: ^4.4 | ^5.2
Requires (Dev)
- phpunit/phpunit: ^9.5
- sepiphy/php-codesniffer: ^3.0
README
Installation
Install sepiphy/console
package via composer.
$ composer require sepiphy/console
Usage
#!/usr/bin/env php <?php namespace Acme; require __DIR__ . '/vendor/autoload.php'; use Sepiphy\Console\Application as SepiphyApplication; use Sepiphy\Console\Command as SepiphyCommand; class HelloCommand extends SepiphyCommand { protected function configure() { $this->setName('hello'); $this->setDescription('Just say hello to you'); $this->addArgument('name'); } protected function fire() { $this->output->line('Hello '.$name = $this->input->getArgument('name') ?? 'You'); $this->output->comment('This is a comment message.'); $this->output->success('This is a success message.'); $this->output->error('This is an error message.'); $this->output->warning('This is a warning message.'); $this->output->note('This is a note message.'); $this->output->caution('This is a caution message.'); $this->container->get('foo-id'); // 'foo-instance' } } $application = new \Sepiphy\Console\Application(); $application->set('foo-id', 'foo-instance'); $application->add(new HelloCommand()); $application->run();