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

Behat Api Context Laravel Package

macpaw/behat-api-context

MacPaw's Behat API Context provides ready-made Behat steps for testing HTTP APIs in PHP. Build requests with Guzzle, send them, and assert status codes, headers, JSON payloads, and response structure, making REST API acceptance tests quicker to write and maintain.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Build vs. buy for acceptance-testing infrastructure. Rather than having an engineer hand-roll a Gherkin-to-HTTP step library (request building, response assertions, JSON path checks, status/header validation), this package offers a prebuilt Behat API context. The decision to evaluate is whether a free MIT-licensed context saves enough engineering time to justify the integration risk.
  • Whether to invest in a BDD acceptance layer at all. It frames the tradeoff between (a) a shared, human-readable Gherkin suite that QA and product can read and contribute to, and (b) the faster, simpler route of PHPUnit/Pest HTTP tests written and owned solely by engineers.
  • Test-strategy scope and ownership. The package supports the roadmap question of who owns API verification: if QA writes .feature files, this is the execution layer; if engineers own all tests, it is largely redundant.
  • Living documentation for public/internal APIs. Reusable step definitions turn feature files into readable specifications of endpoint behavior — useful for onboarding, API consumers, and change review, not just CI pass/fail.
  • Vendor and dependency-risk assessment. Still an early-adopter decision — the repo remains small (6 stars, 0 dependents). v3.1.0 is a maintenance release, not a capability expansion: it widens dependency constraints to support current packages and adds an AGENTS.md. Read this as "still alive and installable on modern dependency trees," not as evidence of adoption. The internal call remains spike, don't standardize.
  • Upgrade-path / lockfile hygiene decision. The widened constraints are the most operationally relevant change: v3.1.0 reduces the chance of a dependency-resolution conflict when installed alongside current Behat/Symfony releases. That lowers integration friction without changing the fundamental risk profile.
  • Reference implementation. Even if not adopted directly, the source is a usable model of what well-scoped API step definitions look like — relevant if the team chooses to build its own context.

When to Consider This Package

Consider it when:

  • Behat is already (or is credibly about to be) in the stack, so the context plugs into existing infrastructure rather than introducing a framework.
  • You need HTTP/API step definitions quickly and want to avoid reinventing request/response assertions.
  • Non-engineers need to read or author executable API specs, making Gherkin's readability a real product benefit.
  • You can absorb early-adopter risk: small community, no downstream dependents, limited third-party documentation, so budget time to read the source and pin a version. v3.1.0 shows the maintainer is still shipping (March 2025), which is reassuring but is not the same as a support commitment.
  • Your CI targets PHP 8.1+ and can run PHPStan max level, PHPCS, and PHPUnit — the repo's own quality gates.
  • Your project is on a recent dependency set: v3.1.0's widened constraints make it materially easier to install alongside current package versions than v3.0.1.

Look elsewhere when:

  • The stack is Laravel-first and not Behat-based. This is a Symfony Bundle, not a Laravel package: it is not auto-discovered and offers no service provider, facade, or Laravel test-client integration. Laravel's built-in $this->getJson() / assertJson* HTTP tests cover most of the same ground with zero added dependencies.
  • The team is standardized on Pest or PHPUnit. Adding Behat plus a Symfony bundle to gain Gherkin syntax is a large architectural tax for a documentation benefit.
  • You need mature, widely adopted tooling with an answerable support channel. A single-maintainer repo with no dependent projects means you are the support channel.
  • Your goal is contract testing, schema fuzzing, or load/performance testing — use Pact, Schemathesis, or k6 instead; this package is functional acceptance testing only.
  • Environment reproducibility matters and you cannot pin PHP: the repo's docker-compose.yaml still targets PHP 8.0 while the code requires 8.1+, so the bundled container path remains stale. The release does not address this.

How to Pitch It (Stakeholders)

To executives: This is a free, MIT-licensed component that could let QA and product write API acceptance tests in plain-language specs, reducing custom test-tooling work. v3.1.0 is a housekeeping release — dependency widening plus repo docs — so nothing about the value proposition or the risk profile has changed. It remains effectively unvalidated by the market (single maintainer, no dependent projects), so treat it as a timeboxed proof of concept of roughly one engineer-day, not a platform commitment. Upside is low cost and no license risk; downside is that we may end up owning the code.

To engineering: It's a Symfony bundle providing a Behat context for HTTP API testing, with real quality gates (PHPStan at max level, PHPCS, PHPUnit, PHP 8.1+). The v3.1.0 release raises dependency ceilings so it installs cleanly against current Behat/Symfony versions — that removes a practical upgrade annoyance but adds no features and no breaking changes, so an existing pin can stay put. It is not Laravel-native — no service provider, no auto-discovery — so integration is manual bundle/context registration. The honest comparison is against Laravel's existing HTTP test helpers and Pest: adopt this only if Behat is already part of our testing story. Otherwise the same coverage arrives with fewer moving parts.

Recommendation framing: Unchanged. Run a short spike against two or three real endpoints, measure setup cost and readability gains, and decide on evidence. Default position is no unless Behat is already present; the dependency-risk profile does not support making it a standard. The only reason to bump a pin now is to unblock a dependency conflict, not to gain capability.

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.
diephp/sequences
users-au/socialite-provider
twidpay/twid-logger
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle