Skip to content

Using Inspectr with PHP

PHP’s built-in web server makes it easy to spin up lightweight APIs for prototypes, demos, or webhook receivers. Inspectr sits in front of your PHP app so you can see every request, replay traffic, and optionally share your endpoint with the outside world.

This guide shows how to connect Inspectr to a basic PHP application.



Create a minimal project structure:

Terminal window
mkdir php-demo
cd php-demo
mkdir public

Inside public/index.php, return a JSON response so it is easy to see in Inspectr:

public/index.php
<?php
header('Content-Type: application/json');
echo json_encode([
'message' => 'Hello from plain PHP!',
'timestamp' => date(DATE_ATOM)
]);

Start PHP’s development server:

Terminal window
php -S localhost:8000 -t public

Your PHP app is now available at:

http://localhost:8000

In a new terminal, launch Inspectr and point it at the PHP server:

Terminal window
inspectr --listen=:8080 --backend=http://localhost:8000

Send a request through Inspectr to confirm it forwards correctly:

Terminal window
curl http://localhost:8080/

You’ll see the request in the terminal output and inside the Inspectr App UI (http://localhost:4004).

Inspectr will:

  • Relay the request to PHP
  • Capture headers, payload, and response timing
  • Let you replay or modify the call during development

Enable Inspectr’s ingress mode to make your local PHP endpoint reachable from third-party services:

Terminal window
inspectr \
--listen=:8080 \
--backend=http://localhost:8000 \
--expose \
--channel=php-demo \
--channel-code=php123

Your PHP app becomes available at:

https://php-demo.in-spectr.dev

Use this URL as a webhook target or share it with teammates. You can pause or revoke access at any time by stopping Inspectr or rotating the channel code.


With Inspectr in place you can:

  • Inspect and replay requests without editing PHP code
  • Capture failing API payloads for easy debugging
  • Expose the PHP app publicly in a single command

Inspectr acts as a smart proxy for PHP applications:

  • Works with the built-in PHP server or full frameworks
  • Adds a visual timeline of requests and responses
  • Simplifies testing integrations that expect a public URL