Skip to content
This repository has been archived by the owner on Sep 3, 2023. It is now read-only.

funivan/console

Repository files navigation

Console

Packagist Software License Build Status Coverage Status Quality Score Total Downloads

Improved symfony console

Install

Via Composer

composer require funivan/console

Usage

  use Funivan\Console\CommandsLoader\FileSystemCommandsLoader;
  use Funivan\Console\NameResolver\StandardNameResolver;
  use Funivan\Console\SingleState\SingleStateConfigurator;

  $configurator = new \Funivan\Console\ConsoleApplicationConfigurator();

  $dispatcher = new \Symfony\Component\EventDispatcher\EventDispatcher();
  $configurator->setEventDispatcher($dispatcher);


  $finder = new \Symfony\Component\Finder\Finder();
  $finder->files()->in(__DIR__ . '/commands/')->name('*.php'); # load commands from commands dir
  
  # Base namespace is 'Commands'
  
  $commandsLoader = (new FileSystemCommandsLoader($finder, new StandardNameResolver('Commands')));
  $configurator->setCommandsLoader($commandsLoader);

  $singleStateConfigurator = new SingleStateConfigurator();
  $configurator->setSingleStateConfigurator($singleStateConfigurator);


  # configure your app
  $consoleApp = new \Funivan\Console\ConsoleApplication();
  $configurator->configure($consoleApp);
  $consoleApp->run();

Testing

    ./vendor/bin/phpunit

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.

About

Improved symfony console

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages