Keploy as a PHP testing framework
Keploy tests PHP applications by recording real HTTP and PDO traffic from a running app, then replaying it as assertions. There are no Guzzle MockHandler queues to build, no PHPUnit doubles to configure, and no test database to migrate before the suite runs.
keploy record -c "php -S 0.0.0.0:8000 -t public"What Keploy gives a PHP team
Any PHP app, unchanged
Keploy runs the app through the built-in server, PHP-FPM, or FrankenPHP. Laravel, Symfony, Slim, and plain PSR-15 stacks all record the same way because capture happens at the socket.
- PHP 8.0 and above
- Built-in server, FPM, or FrankenPHP
- Laravel, Symfony, Slim, Laminas
- No test bootstrap changes
Why PHP 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 PHP: by hand, with PHPUnit + Guzzle MockHandler, or with Keploy
PHPUnit doubles and a MockHandler queue are both written from your model of a dependency. Keploy records what the dependency actually returned, so re-recording refreshes every mock at once.
Select any row for the full comparison, with code.
What you write for PHP vs what Keploy records
All three produce the same assertion. Only the third still passes after the next refactor without anyone editing it.
Two stub classes exist only for this file, and both hard-code a shape nothing verifies against the real MySQL rows or Stripe response.
Fast and dependency-free — and the Stripe body is a literal, while the queue itself couples the test to how many calls the code happens to make.
Mocks are matched to the call that produced them rather than queued in order, so adding an unrelated request does not break the recorded case.
Times are estimates for authoring one endpoint’s coverage from scratch, not measurements.
PHP 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 PHP app once, replay it forever
Keploy sits below your PHP 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 PHP service and captures the dependency calls it makes.
What Keploy mocks for PHP, with zero config
5 of the 7 dependencies a typical PHP 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 PDO and mysqli
- Auto-mocked
PostgreSQLView page
Postgres protocol under PDO_pgsql
- Auto-mocked
RedisView page
RESP under phpredis and Predis
- Auto-mocked
MongoDBView page
Wire protocol under the mongodb extension
- Outbound HTTPAuto-mocked
Outbound HTTP
Any Guzzle, Symfony HttpClient, or cURL call
- Partial
MemcachedView page
Memcached text and binary protocol
- Partial
RabbitMQView page
AMQP under php-amqplib
Your first PHP test suite in under five minutes
Every command below runs against your existing PHP 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 -S 0.0.0.0:8000 -t public"3Exercise the paths you care about
Drive the app with curl or your frontend. Every request becomes a test case with its PDO queries and Guzzle calls captured alongside.
curl -X POST localhost:8000/orders/ord_1/confirm -H 'Content-Type: application/json' -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 -S 0.0.0.0:8000 -t public" --delay 8
Ready to try it on your own PHP service?
Works with the rest of your PHP stack
Keploy records at the network layer, so framework and driver choices inside your PHP app do not change how it captures traffic.
Laravel
Recorded through artisan serve or FPM — no RefreshDatabase needed.
Symfony
Same capture path; the kernel and bundles run in full.
Eloquent
Queries record as the SQL they emit, with real rows.
Doctrine
DQL records as the SQL Doctrine generates.
MySQL
The database page covers protocol-level capture in depth.
Composer
Nothing to require — Keploy is a CLI, not a package.
Testing the rest of your stack
- Frameworks
Keploy as a Laravel testing framework
Test Laravel routes against recorded Eloquent queries and real HTTP responses, without RefreshDatabase or Http::fake.
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