behat/gherkin

Gherkin DSL parser for PHP

Installs: 120 640 914

Dependents: 66

Suggesters: 0

Security: 0

Stars: 1 044

Watchers: 18

Forks: 91

Open Issues: 22

v4.9.0 2021-10-12 13:05 UTC

README

This is the php Gherkin parser for Behat. It comes bundled with more than 40 native languages (see i18n.php) support & 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 http://getcomposer.org/installer | php
$> php composer.phar update

Contributors