{"id":19199811,"url":"https://github.com/libresign/behat-builtin-extension","last_synced_at":"2026-03-12T08:41:06.674Z","repository":{"id":36985068,"uuid":"461944045","full_name":"LibreSign/behat-builtin-extension","owner":"LibreSign","description":"Extension to use built-in PHP server on Behat tests","archived":false,"fork":false,"pushed_at":"2024-10-31T18:55:45.000Z","size":388,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-16T02:20:00.550Z","etag":null,"topics":["api","bdd","behat","behat-extension","hacktoberfest","php","php-builtin-server","test-automation","tests"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LibreSign.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-02-21T16:31:20.000Z","updated_at":"2024-11-01T12:09:04.000Z","dependencies_parsed_at":"2023-12-04T13:36:14.004Z","dependency_job_id":"6e1d0fee-7e61-4186-8b67-8ad469e0a0dd","html_url":"https://github.com/LibreSign/behat-builtin-extension","commit_stats":{"total_commits":52,"total_committers":2,"mean_commits":26.0,"dds":0.3846153846153846,"last_synced_commit":"52cdec68a6fd660134b9c5e5520db401b2cb311c"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LibreSign%2Fbehat-builtin-extension","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LibreSign%2Fbehat-builtin-extension/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LibreSign%2Fbehat-builtin-extension/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LibreSign%2Fbehat-builtin-extension/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LibreSign","download_url":"https://codeload.github.com/LibreSign/behat-builtin-extension/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253173117,"owners_count":21865631,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","bdd","behat","behat-extension","hacktoberfest","php","php-builtin-server","test-automation","tests"],"created_at":"2024-11-09T12:29:04.757Z","updated_at":"2026-03-12T08:41:06.617Z","avatar_url":"https://github.com/LibreSign.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Behat](https://github.com/LibreSign/behat-builtin-extension/actions/workflows/behat.yml/badge.svg)](https://github.com/LibreSign/behat-builtin-extension/actions/workflows/behat.yml)\n\n# Extension to use built-in PHP server on Behat tests\n\n## Instalation\n\n```bash\ncomposer require libresign/behat-builtin-extension\nvendor/bin/behat --init\n```\n\n## Configuration\n\nAdd the extension to your `behat.yml`:\n\n```yaml\ndefault:\n  extensions:\n    PhpBuiltin\\Server:\n      verbose: false\n      rootDir: /var/www/html\n      host: localhost\n```\n\n### Config values\n\n| config  | default       | Environment    | Description                                                                                                                                                      |\n| ------- | ------------- | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| verbose | false         | BEHAT_VERBOSE  | Enables/disables verbose mode                                                                                                                                    |\n| rootDir | /var/www/html | BEHAT_ROOT_DIR | Specifies http root dir                                                                                                                                          |\n| host    | localhost     | BEHAT_HOST     | Host domain or IP                                                                                                                                                |\n| runAs   |               | BEHAT_RUN_AS   | The username to be used to run the built-in server                                                                                                               |\n| workers | 0             | BEHAT_WORKERS  | The quantity of workers to use. More informations [here](https://www.php.net/manual/en/features.commandline.webserver.php) searching by `PHP_CLI_SERVER_WORKERS` |\n\nYou can also use `-v` option to enable verbose mode. Example\n```bash\nvendor/bin/behat -v\n```\nThe verbose mode will show:\n* The rootDir used\n* The output of PHP Built-in server\n\n## Usage example\n\n```php\n\u003c?php\n\nuse Behat\\Behat\\Context\\Context;\nuse PhpBuiltin\\RunServerListener;\n\n/**\n * Defines application features from the specific context.\n */\nclass FeatureContext implements Context\n{\n    private string $baseUrl;\n    public function __construct()\n    {\n        $this-\u003ebaseUrl = RunServerListener::getServerRoot();\n    }\n\n    public function sendRequest(string $verb, string $url, ?array $body = null, array $headers = []): void\n    {\n        $client = new Client();\n\n        $fullUrl = $this-\u003ebaseUrl . ltrim($url, '/');\n\n        $options['headers'] = $headers;\n\n        if (is_array($body)) {\n            $options['form_params'] = $body;\n        }\n\n        try {\n            $this-\u003eresponse = $client-\u003e{$verb}($fullUrl, $options);\n        } catch (ClientException $e) {\n            $this-\u003eresponse = $e-\u003egetResponse();\n        } catch (ServerException $e) {\n            $this-\u003eresponse = $e-\u003egetResponse();\n        }\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibresign%2Fbehat-builtin-extension","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flibresign%2Fbehat-builtin-extension","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibresign%2Fbehat-builtin-extension/lists"}