Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Module Phpbrowser Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Getting Started

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().

Implementation Patterns

  • Functional regression suites: Use for fast, reliable HTTP assertion tests (e.g., validating HTML responses, form submissions, status codes).
  • API contract testing: Pair with REST/soap helpers; tester->sendGET(), tester->seeResponseCodeIs(), and tester->seeResponseContainsJson().
  • Simulated form handling: Use tester->submitForm() to POST data and verify redirects or response content.
  • Parallel with other modules: Combine with WebDriver (e.g., via group configs) to fallback to headless browser only when JS interaction is needed.

Gotchas and Tips

  • No JavaScript support: This is not a browser engine—tests relying on JS (SPA navigation, fetch callbacks, events) will fail silently or behave unexpectedly. Use WebDriver for JS-dependent flows.
  • Cookie persistence: Cookies persist across requests within a single test, but not across tests unless explicitly shared. Use tester->resetCookie() in _after() for isolation.
  • Relative URLs: amOnPage() interprets paths as relative to the configured url; double-check trailing slashes.
  • Debugging: Enable show_request_headers/show_response_headers in config for logging; use tester->grabPageSource() for inspecting raw HTML when assertions fail.
  • Timeouts: Configure 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.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle