Keploy as a Laravel testing framework
Keploy tests Laravel applications by recording real requests through the running server and every Eloquent query or HTTP client call they trigger, then replaying both as assertions. RefreshDatabase never runs, because there is no test database to migrate.
keploy record -c "php artisan serve --port=8000"What Keploy gives a Laravel team
Any Laravel app, unchanged
Keploy runs the app through artisan serve, Octane, or PHP-FPM. Route middleware, form request validation, and service providers all execute because capture happens at the socket.
- Laravel 9 and above
- artisan serve, Octane, or FPM
- API and web routes
- Providers boot for real
Why Laravel integration tests slow teams down
The friction is rarely the assertions. It is everything around them — spinning up dependencies, keeping mocks honest, and repairing tests after every refactor.
Testing Laravel: by hand, with PHPUnit + Http::fake, or with Keploy
Http::fake and RefreshDatabase buy convenience with a frozen upstream contract and a migration run per suite. Keploy records the real exchanges instead, so neither cost is paid.
Select any row for the full comparison, with code.
What you write for Laravel vs what Keploy records
All three produce the same assertion. Only the third still passes after the next refactor without anyone editing it.
An anonymous class bound into the container for one test. It hard-codes a row shape that nothing checks against the real orders table.
Expressive and idiomatic — and it needs a migrated test database, a factory, and a Stripe body typed out by hand.
The mock is the SQL Eloquent actually compiled, backticks and all, so a scope or relation change shows up as a diff rather than passing against a factory record.
Times are estimates for authoring one endpoint’s coverage from scratch, not measurements.
Laravel testing tools, compared
The options a team on PHP actually reaches for, and where each one genuinely wins. Select a row for the full comparison.
Assessments reflect each tool’s documented behaviour, not benchmark measurements.
Record your Laravel app once, replay it forever
Keploy sits below your Laravel process at the network layer. It watches the calls your app already makes, then serves them back on replay so tests run with no dependencies attached.
Keploy records a GET call to /api/v1/orders/{id} on a Laravel service and captures the dependency calls it makes.
What Keploy mocks for Laravel, with zero config
5 of the 6 dependencies a typical Laravel service talks to are stubbed from the recording itself — no mock classes, no fixture files, no containers in CI.
- Auto-mocked
MySQLView page
MySQL protocol under Eloquent and the query builder
- Auto-mocked
PostgreSQLView page
Postgres protocol under Eloquent
- Auto-mocked
RedisView page
RESP under phpredis, cache, and queues
- Auto-mocked
MongoDBView page
Wire protocol under the mongodb extension
- Outbound HTTPAuto-mocked
Outbound HTTP
Any Http facade or Guzzle call
- Partial
Amazon S3
S3 REST API via Flysystem
Your first Laravel test suite in under five minutes
Every command below runs against your existing Laravel service. Nothing in your source tree changes.
1Install the Keploy CLI
A single binary. It needs a Linux kernel with eBPF support, or Docker on macOS and Windows — and it adds nothing to your project's dependencies.
curl -sSL https://keploy.io/install.sh | bash2Record your service
Pass the command you already use to start the app. Keploy runs it and watches every socket it opens.
keploy record -c "php artisan serve --port=8000"3Exercise the paths you care about
Drive the running app. Every request becomes a test case with its Eloquent queries and HTTP client calls captured alongside.
curl -X POST localhost:8000/api/orders/ord_1/confirm -H 'Content-Type: application/json' -H 'Authorization: Bearer $TOKEN' -d '{"payment_token":"tok_123"}'4Replay in CI
Replay serves the recorded dependency responses, so the job needs no service containers and no Docker daemon.
keploy test -c "php artisan serve --port=8000" --delay 8
Ready to try it on your own Laravel service?
Works with the rest of your Laravel stack
Keploy records at the network layer, so framework and driver choices inside your Laravel app do not change how it captures traffic.
PHP
The language page covers driver-level coverage in depth.
Eloquent
Queries record as the SQL they compile to, with real rows.
MySQL
The database page covers protocol-level capture in depth.
Redis
Cache and queue traffic records as real RESP exchanges.
Laravel Octane
Record through Octane to exercise the long-lived worker path.
Composer
Nothing to require — Keploy is a CLI, not a package.
Testing the rest of your stack
- Languages
Keploy as a PHP testing framework
Record a running PHP app once and replay real PDO result sets and Guzzle responses without a MockHandler stack per test.
Read the guide - Databases
Keploy as a MySQL testing framework
Mock MySQL at the wire protocol instead of standing up a container or swapping in H2 — the rows your queries really returned, replayed.
Read the guide - Databases
Keploy as a PostgreSQL testing framework
Record the Postgres frontend/backend protocol once and replay real result sets in tests — no container, no pg-mem, no schema to rebuild.
Read the guide - Caches & Stores
Keploy as a Redis testing framework
Record RESP traffic once and replay real cache hits, misses, TTLs, and pipeline responses without a Redis server in CI.
Read the guide - Databases
Keploy as a MongoDB testing framework
Mock MongoDB at the wire protocol — real documents, real BSON types, real aggregation results — without a mongod binary in CI.
Read the guide - Message Queues
Keploy as a RabbitMQ testing framework
Test publishers and consumers against recorded AMQP exchanges, with no broker to start and no queue to declare.
Read the guide
Join our GlobalCommunity
Connect with developers worldwide. Follow updates, ask questions, share feedback, and ship faster with other Keploy builders.
“Best report of integration and API tests I've seen — which we don't get from RestAssured.”
G2“Future of microservices testing. I don't write tests now!”
G2 · 5/5“An amazing product that simplifies the automation.”
Gartner · 4.0