codeception/module-phpbrowser
Codeception module built on PhpBrowser to test web apps over HTTP without a real browser. Supports making requests, filling and submitting forms, following redirects, and asserting responses, headers, status codes, and page content in functional and API tests.
Install via Composer: composer require --dev codeception/module-phpbrowser. Then enable it in your acceptance.suite.yml (or equivalent suite config) under modules:
modules:
enabled:
- PhpBrowser:
url: 'http://localhost'
- \Helper\Acceptance
Start with basic HTTP requests—ideal for testing APIs or headless web apps where you don’t need JS execution. Write your first test in tests/acceptance/ using tester->amOnPage(), tester->see(), and tester->seeInCurrentUrl().
tester->sendGET(), tester->seeResponseCodeIs(), and tester->seeResponseContainsJson().tester->submitForm() to POST data and verify redirects or response content.WebDriver (e.g., via group configs) to fallback to headless browser only when JS interaction is needed.tester->resetCookie() in _after() for isolation.amOnPage() interprets paths as relative to the configured url; double-check trailing slashes.show_request_headers/show_response_headers in config for logging; use tester->grabPageSource() for inspecting raw HTML when assertions fail.timeout and curl options (e.g., follow_redirects, ssl_verify) per your app’s needs—default timeout is 30s and may lag with slow endpoints.How can I help you explore Laravel packages today?