imbo/behat-api-extension
Behat 3 extension for testing JSON-based APIs. Simplifies making HTTP requests, asserting responses, and validating JSON payloads in your scenarios. Inspired by behat/web-api-extension and built for API testing workflows like Imbo.
Adopt if:
Look elsewhere if:
"This package lets us test our APIs faster and with fewer bugs by letting product teams define API behavior in plain English—just like user stories. For example, instead of writing complex code to validate an API response, a PM can write:
Given I have a valid user token
When I send a POST request to "/orders" with:
{
"product_id": 123,
"quantity": 2
}
Then the response should have status code 201 And the response should contain "order_id" in the root.
*This reduces dev/QA bottlenecks, improves API reliability, and aligns testing with business requirements. It’s also MIT-licensed and actively maintained, so no vendor lock-in."*
### **For Engineering**:
*"This is a lightweight, well-documented Behat extension that bridges the gap between BDD and API testing. Key benefits:*
- **Seamless integration**: Works with existing Behat suites; no need to rewrite tests.
- **Rich assertions**: Supports JSONPath-like queries, status code checks, and complex data validation (e.g., nested arrays, form data).
- **HTTP flexibility**: Handles all methods (PATCH, DELETE, etc.) and multipart uploads—critical for modern APIs.
- **Performance**: Minimal overhead; runs in CI/CD pipelines like any Behat test.
*Downside: Requires PHP 8.1+ (but worth the upgrade for long-term maintainability). Docs are [here](https://behat-api-extension.readthedocs.io/).*
*Alternatives like `behat/web-api-extension` are outdated; this is the active fork."*
How can I help you explore Laravel packages today?