behat / gherkin
Gherkin DSL parser for PHP
Fund package maintenance!
carlos-granados
stof
acoulton
Installs: 166 856 848
Dependents: 94
Suggesters: 0
Security: 0
Stars: 1 056
Watchers: 16
Forks: 95
Open Issues: 10
pkg:composer/behat/gherkin
Requires
- php: >=8.1 <8.6
- composer-runtime-api: ^2.2
Requires (Dev)
- cucumber/gherkin-monorepo: dev-gherkin-v36.0.0
- friendsofphp/php-cs-fixer: ^3.77
- mikey179/vfsstream: ^1.6
- phpstan/extension-installer: ^1
- phpstan/phpstan: ^2
- phpstan/phpstan-phpunit: ^2
- phpunit/phpunit: ^10.5
- symfony/yaml: ^5.4 || ^6.4 || ^7.0
Suggests
- symfony/yaml: If you want to parse features, represented in YAML files
- dev-master / 4.x-dev
- v4.15.0
- v4.14.0
- v4.13.0
- v4.12.0
- v4.11.0
- v4.10.0
- v4.9.0
- v4.8.0
- v4.7.3
- v4.7.2
- v4.7.1
- v4.7.0
- v4.6.2
- v4.6.1
- v4.6.0
- v4.5.1
- v4.5.0
- v4.4.5
- v4.4.4
- v4.4.3
- v4.4.2
- v4.4.1
- v4.4.0
- v4.3.0
- v4.2.1
- v4.2.0
- v4.1.3
- v4.1.2
- v4.1.1
- v4.1.0
- v4.0.0
- 3.1.x-dev
- v3.1.3
- v3.1.2
- v3.1.1
- v3.1.0
- 3.0.x-dev
- v3.0.5
- v3.0.4
- v3.0.3
- v3.0.2
- v3.0.1
- v3.0.0
- 2.3.x-dev
- v2.3.5
- v2.3.4
- v2.3.3
- v2.3.2
- v2.3.1
- v2.3.0
- v2.2.9
- v2.2.8
- v2.2.7
- v2.2.6
- v2.2.5
- v2.2.4
- v2.2.3
- v2.2.2
- v2.2.1
- v2.2.0
- v2.1.1
- v2.1.0
- v2.0.2
- v2.0.1
- v2.0.0
- v1.1.4
- v1.1.3
- v1.1.2
- dev-cucumber-update-1763018358
- dev-cucumber-update-1759994327
- dev-cucumber-update-1758438917
This package is auto-updated.
Last update: 2025-12-02 10:23:20 UTC
README
This is the php Gherkin parser for Behat. It comes bundled with more than 40 native languages (see i18n.php) support
and clean architecture.
Useful Links
Usage Example
<?php $keywords = new Behat\Gherkin\Keywords\ArrayKeywords(array( 'en' => array( 'feature' => 'Feature', 'background' => 'Background', 'scenario' => 'Scenario', 'scenario_outline' => 'Scenario Outline|Scenario Template', 'examples' => 'Examples|Scenarios', 'given' => 'Given', 'when' => 'When', 'then' => 'Then', 'and' => 'And', 'but' => 'But' ), 'en-pirate' => array( 'feature' => 'Ahoy matey!', 'background' => 'Yo-ho-ho', 'scenario' => 'Heave to', 'scenario_outline' => 'Shiver me timbers', 'examples' => 'Dead men tell no tales', 'given' => 'Gangway!', 'when' => 'Blimey!', 'then' => 'Let go and haul', 'and' => 'Aye', 'but' => 'Avast!' ) )); $lexer = new Behat\Gherkin\Lexer($keywords); $parser = new Behat\Gherkin\Parser($lexer); $feature = $parser->parse(file_get_contents('some.feature'));
Installing Dependencies
curl https://getcomposer.org/installer | php
php composer.phar update
Contributors
- Konstantin Kudryashov everzet [original developer]
- Andrew Coulton acoulton [current maintainer]
- Carlos Granados carlos-granados [current maintainer]
- Christophe Coevoet stof [current maintainer]
- Other awesome developers
Support the project
Behat is free software, maintained by volunteers as a gift for users. If you'd like to see the project continue to thrive, and particularly if you use it for work, we'd encourage you to contribute.
Contributions of time - whether code, documentation, or support reviewing PRs and triaging issues - are very welcome and valued by the maintainers and the wider Behat community.
But we also believe that financial sponsorship is an important part of a healthy Open Source ecosystem. Maintaining a project like Behat requires a significant commitment from the core team: your support will help us to keep making that time available over the long term. Even small contributions make a big difference.
You can support @acoulton, @carlos-granados and @stof on GitHub sponsors. If you'd like to discuss supporting us in a different way, please get in touch!