Skip to content

Commit

Permalink
Readme: add example
Browse files Browse the repository at this point in the history
  • Loading branch information
f3l1x committed Nov 27, 2016
1 parent b084b6c commit 706fe74
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ extensions:

```

Extension looks for all commands extending from `Contributte\Console\Command\BaseCommand`. And automatically adds them to the console application.
That's all. You don't have to be worried.

## Configuration

### URL address
Expand All @@ -40,6 +43,39 @@ console:
url: www.example.com
```

## Example

```php
use Contributte\Console\Command\BaseCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

final class FooCommand extends BaseCommand
{

/**
* Configure command
*
* @return void
*/
protected function configure()
{
$this->setName('foo');
}

/**
* @param InputInterface $input
* @param OutputInterface $output
* @return void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
// Some magic..
}

}
```

-----

Thank you for testing, reporting and contributing.
12 changes: 12 additions & 0 deletions tests/fixtures/FooCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
namespace Tests\Fixtures;

use Contributte\Console\Command\BaseCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

/**
* @author Milan Felix Sulc <sulcmil@gmail.com>
Expand All @@ -20,4 +22,14 @@ protected function configure()
$this->setName('foo');
}

/**
* @param InputInterface $input
* @param OutputInterface $output
* @return void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
// Some magic..
}

}

0 comments on commit 706fe74

Please sign in to comment.