It is easy to configure and activate tasks in GrumPHP. Tasks live under their own namespace in the parameters part. To activate a task, it is sufficient to add an empty task configuration:
# grumphp.yml
parameters:
tasks:
ant: ~
atoum: ~
behat: ~
brunch: ~
clover_coverage: ~
codeception: ~
composer: ~
composer_script: ~
doctrine_orm: ~
gherkin: ~
git_blacklist: ~
git_commit_message: ~
git_conflict: ~
grunt: ~
gulp: ~
jsonlint: ~
kahlan: ~
make: ~
npm_script: ~
phing: ~
php7cc: ~
phpcpd: ~
phpcs: ~
phpcsfixer: ~
phpcsfixer2: ~
phplint: ~
phpmd: ~
phpparser: ~
phpspec: ~
phpunit: ~
phpversion: ~
robo: ~
securitychecker: ~
shell: ~
xmllint: ~
yamllint: ~
Every task has it's own default configuration. It is possible to overwrite the parameters per task.
- Ant
- Atoum
- Behat
- Brunch
- Clover Coverage
- Codeception
- Composer
- Composer Script
- Doctrine ORM
- Gherkin
- Git blacklist
- Git commit message
- Git conflict
- Grunt
- Gulp
- JsonLint
- Kahlan
- Make
- NPM script
- Phing
- Php7cc
- PhpCpd
- Phpcs
- PHP-CS-Fixer
- PHP-CS-Fixer 2
- PHPLint
- PhpMd
- PhpParser
- Phpspec
- Phpunit
- PhpVersion
- Robo
- Security Checker
- Shell
- XmlLint
- YamlLint
Every task has a pre-defined metadata
key on which application specific options can be configured.
For example:
# grumphp.yml
parameters:
tasks:
anytask:
metadata:
blocking: true
priority: 0
priority
Default: 0
This option can be used to specify the order in which the tasks will be executed. The higher the priority, the sooner the task will be executed.
blocking
Default: true
This option can be used to make a failing task non-blocking. By default all tasks will be marked as blocking. When a task is non-blocking, the errors will be displayed but the tests will pass.
It is very easy to configure your own project specific task.
You just have to create a class that implements the GrumPHP\Task\TaskInterface
.
Next register it to the service manager and add your task configuration:
# grumphp.yml
parameters:
tasks:
myConfigKey:
config1: config-value
services:
task.myCustomTask:
class: My\Custom\Task
arguments:
- '@config'
tags:
- {name: grumphp.task, config: myConfigKey}
Note: You do NOT have to add the main and task configuration. This example just shows you how to do it. You're welcome!
You just registered your custom task in no time! Pretty cool right?!