Weave 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

Laravel Browser Kit Macro Laravel Package

pbmedia/laravel-browser-kit-macro

pbmedia/laravel-browser-kit-macro adds useful macros to Laravel's Browser Kit, extending its fluent HTTP testing API with convenient helpers and assertions so you can write cleaner, more expressive feature tests for Laravel applications.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit. The package is a thin, single-purpose dev-time shim: a macro (typically a trait registered in setUp() or via a service provider) that re-exposes Laravel 5.3's BrowserKit-style test API — visit(), see(), click(), type(), press(), seePageIs() — on modern Illuminate\Foundation\Testing\TestCase classes. It has no runtime footprint, no container bindings, no queue/route/config surface, and no production blast radius. Architecturally it is a compatibility bridge, and should be treated as scaffolding, not as an architectural dependency. Release 5.9.0 changes nothing here: the diff is a PHP 8.5 compatibility bump, not a change in scope or design posture.

Integration feasibility. Low technical effort: composer require --dev, register the macro, run the affected test subset. The real work is verification, not integration. Three things need to be confirmed against our stack before committing: (1) whether the package pulls laravel/browser-kit-testing transitively or vendors the logic itself, since that first-party package is deprecated and is the actual compatibility anchor; (2) whether it supports our PHPUnit major (PHPUnit 10/11 changed lifecycle and removed annotation-era assumptions that macro registration in setUp() can trip over) — 5.9.0 confirms PHP 8.5 support but says nothing about PHPUnit; (3) whether Symfony browser-kit and dom-crawler remain installable at our pinned Symfony major.

Technical risk. Adoption signal remains essentially absent: 2 stars, 0 dependents, effectively a single-maintainer project. The 5.9.0 release is a modest positive counter-signal: a real code change (PHP 8.5 support) merged from an external contributor (@realpascalbotjet, PR #12), which implies CI that actually runs on at least one current runtime. That downgrades "unmaintained body with fresh metadata tag" — the worst-case read in the prior assessment — to "sporadically maintained by one person, accepts community patches." It does not upgrade it to "field-validated." There is still no evidence of anyone else running this against the edge cases we will hit, and no published PHPUnit/Symfony matrix. The directional risk is unchanged: the macro preserves a testing style Laravel deliberately removed, so we would be coupling our test suite's forward-compatibility to a package whose entire purpose is backward-compatibility. Note also that a PHP 8.5 patch is the cheapest possible form of maintenance — it keeps the package installable without addressing the deprecated-API direction of travel.

Key questions.

  • Which exact Laravel / PHP / PHPUnit / Pest versions are exercised in the package's CI matrix, and is that matrix public? 5.9.0 evidences PHP 8.5 only.
  • Does the macro depend on laravel/browser-kit-testing, and if so, is that dependency pinned to a fork or to the abandoned original?
  • Does 5.9.0's version line track Laravel majors (i.e. does 5.x target Laravel 12), and is there a documented support window?
  • How many tests in our suite actually use the 5.3-style API, and why — legacy carryover from an upgrade in flight, or a genuine need for click-through/form-flow simulation that native HTTP tests can't express?
  • If the need is genuine multi-page/JS behavior, is Dusk or Playwright the better target than a BrowserKit shim?
  • What is the exit cost — can the macro be deleted in a single PR once tests are rewritten?
  • Has the maintainer ever stated a support policy, or is 5.9.0 best read as ad-hoc responsiveness rather than a commitment?

TPM recommendation. Unchanged in substance: the macro's idea is worth using; the dependency probably is not. Vendor the trait into tests/Support/ with a header comment pointing at the origin (and noting the 5.9.0 SHA reviewed). That preserves the migration unblock while removing supply-chain, abandonment, and SBOM exposure entirely — at approximately the same engineering cost as integrating the package. 5.9.0 slightly reduces the probability of a mid-upgrade abandonment surprise but does not reduce the cost of being wrong, and does not touch the PHPUnit/Symfony compatibility unknowns that are the actual blockers.

Integration Approach

Stack fit. Dev-only dependency (require-dev), applicable to Laravel 8–12 projects with PHPUnit or Pest, used exclusively during composer test / CI. It changes nothing about deploy artifacts, image size, runtime dependency graph, or infrastructure. That makes it one of the few dependency decisions that can be made by the test-infrastructure owner without platform sign-off — and should be scoped that way in the decision record.

Migration path. Two viable directions, and the choice should be made explicitly rather than by default:

  • Bridge (short-term): adopt the macro so the legacy visit()/see()/click() suite stays green while the framework underneath is upgraded. This deliberately decouples "upgrade Laravel" from "rewrite tests," which is usually the right call when the upgrade is time-boxed and the test rewrite is not.
  • Replace (long-term): convert to native $this->get(), assertSee(), assertRedirect(), withSession(), actingAs(); escalate to Dusk/Playwright only where real browser interaction is required. Set a dated target for this; a bridge with no expiry becomes permanent architecture.

Compatibility. Verify before merge: composer constraints against our locked Laravel and PHPUnit; absence of conflicts with laravel/dusk or pestphp/pest; PHPUnit 10+ attribute support if we're past v9; Symfony BrowserKit/DomCrawler availability at our Symfony major; and method-name collisions between the macro's additions and newer TestCase/MakesHttpRequests methods (these surface as confusing runtime failures, not install errors, so they need a deliberate smoke test). If we pin rather than vendor, pin to 5.9.0 specifically and re-verify — a PHP 8.5 patch can move the transitive dependency floor, so re-read composer.lock after the bump rather than assuming it is inert.

Sequencing.

  1. Inventory: grep the suite for ->visit(, ->see(, ->click(, ->type(. Size the affected test count and the CI minutes they represent.
  2. Spike: install 5.9.0 on a throwaway branch, run only the legacy subset, record pass rate and failures. Timebox to a day.
  3. Decide: vendor the macro vs. pin 5.9.0 (exact version, composer.lock reviewed, added to the dependency-review checklist).
  4. Proceed with the framework/PHPUnit upgrade in parallel — this is the whole point of the bridge.
  5. Convert the legacy subset to native assertions in batches, deleting macro usage as each file moves.
  6. Remove the trait/package once the grep returns zero; close the decision record.

Operational Impact

Maintenance. Near-zero runtime maintenance, non-zero dependency hygiene. A low-adoption, effectively single-maintainer package in require-dev still appears in SBOMs and audit output, still requires a justification line in dependency reviews, and can still block a PHPUnit or Symfony major upgrade at exactly the moment we need to move fast. 5.9.0 demonstrates the maintainer will take a compatibility PR, which is mildly reassuring for routine runtime bumps, but the package has no test matrix published for the axes we care about. Vendoring shifts this from "dependency we track" to "code we own," which for a file this size is the lower-cost option.

Support. No vendor. Community-only via GitHub issues with effectively no user base, meaning no one else has hit our failure modes and no one else will answer — though PR #12 shows external patches do land, so contributing an upstream fix is at least nominally viable. Budget for self-support regardless: someone must be able to read the trait and patch it. Assign explicit internal ownership to the test-infrastructure/QA lead and note it in the runbook.

Scaling. Trivially scales as code; the scaling concern is CI economics, not throughput. BrowserKit-style tests boot the full HTTP kernel and crawl the DOM per assertion, which is materially slower per test than Laravel's native HTTP tests. At a few hundred tests that is noise; at a few thousand it is a visible CI-minutes line item and a feedback-loop tax on every PR. Quantify the delta during the spike and cap adoption to the legacy subset — forbid new tests from using the macro.

Failure modes.

  • Silent upgrade breakage: macro fails to register after a Laravel or PHPUnit bump, producing BadMethodCallException across the suite at setUp() — loud, at least, but landing on the critical path of an unrelated upgrade. 5.9.0 reduces the PHP-runtime variant of this; the PHPUnit variant is unaddressed.
  • Transitive trap: a dependency on deprecated laravel/browser-kit-testing or an older Symfony BrowserKit makes composer update unsatisfiable, which can escalate from "annoying" to "cannot patch a CVE in a dev dependency," blocking security remediation work.
  • Method collision: newer TestCase methods shadow or conflict with macro-provided names, yielding failures that look like application bugs.
  • False confidence: legacy assertions are looser than modern equivalents; a green suite may assert less than the team assumes. This is the most dangerous failure because it is silent and persists.
  • Abandonment: lower likelihood after 5.9.0, but still live — a single responsive maintainer is not a support commitment, and a lapse would leave no upstream fix path mid-upgrade. Vendoring neutralizes this entirely.

Ramp-up. Effectively zero for engineers who worked in the 5.3 era — an hour with an example test is enough. But for anyone who joined after Laravel 5.4, this is a deprecated API with no current official documentation, and they will be learning it from source. That reverse-ramp cost is the strongest argument for containment: confine the macro to pre-existing tests being carried through the upgrade, convert them on a schedule, and never let it become the documented way to write a new test.

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.
ignibyte/aic-framework
glavweb/data-schema-bundle
glavweb/datagrid-bundle
tacticmedia/scim-server
uni-method/frame
neika-ai/sdk
adachsoft/php-code-style
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
adachsoft/api-version-bundle
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox