Laravel API Client
A Postman-style REST client built specifically for Laravel — inside VS Code.
Open a Laravel project and every endpoint is discovered automatically: routes, prefixes, path parameters, middleware — and a ready-to-send request with a sample payload inferred from your FormRequests and validation rules. Test your API against any environment with {{variables}}, without ever leaving the editor or hand-typing a URL.
Works with classic apps, Laravel 11+ bootstrap/app.php routing, modular projects (nwidart/laravel-modules), and custom nested route folders.
Why this instead of a generic REST client?
A generic client makes you build every request by hand. This extension already knows your app:
- Every route, listed and searchable — no copying URIs out of
route:list.
- The request body is pre-filled from the controller's FormRequest
rules() or inline $request->validate([...]) — realistic sample values, nested fields, password_confirmation, the first in: option, the lot.
- Auth is pre-configured — routes behind
auth middleware start with Bearer {{token}} already set.
- One click from request to code — jump from any endpoint straight to its controller method.
Features
Route discovery
- Uses
php artisan route:list --json when PHP is available — exact, always complete.
- Falls back to a static parser that understands real-world route files:
- all verbs,
Route::match, Route::any, Route::view, Route::redirect, invokable controllers
Route::resource / apiResource with ->only() / ->except()
- nested
prefix()->name()->middleware()->group() chains and Route::group([...])
Route::controller(X::class) groups and Controller@method strings
- Nested route folders (
routes/ecommerce/v2/api.php, routes/auth/…): registrations in RouteServiceProvider, bootstrap/app.php (withRouting, apiPrefix), Route::group(base_path(...)) and require __DIR__.'/...' are parsed, so each file gets its real URL prefix, name prefix and middleware.
- Modular projects:
Modules/*/routes/*.php (v10+ app/ layout and classic), module_path() registrations, and modules_statuses.json (disabled modules are skipped).
- Routes auto-refresh when route files change.
Payload inference
When you open a route, the extension reads the controller method and builds a sample body from:
- a type-hinted FormRequest → its
rules() array (string and array syntax, Rule::in([...]), wildcard items.*.id, dotted nested keys), or
- inline
$request->validate([...]) / Validator::make(...).
Rules become sensible values — email → user@example.com, boolean → true, confirmed adds the _confirmation field, in:a,b picks a, and field names guide the rest (phone, price, status, …). For GET routes the fields become suggested query params.
Request panel
- Modern, theme-aware UI: color-coded method picker, params (path + query), headers, JSON / form-urlencoded body, Bearer & Basic auth.
- Response with status, time, size, pretty-printed & highlighted JSON, and headers.
- Warnings that save you time: unresolved
{{variables}} and unfilled {id} path parameters are flagged on every send.
- Save requests to a shared team collection, copy as cURL, and jump to the controller with Source.
Routes page
A full-screen, sticky-header table of every endpoint — live multi-word search across method, URI, name, controller and middleware; method filter chips; sortable columns; click a row to open the request. Built to stay fast with hundreds of routes.
Environments & variables
- Unlimited environments (Local, Staging, Production, …), each a set of
{{variable}} values usable in the URL, params, headers, body and auth fields.
- Switch the active environment from the request panel or the sidebar.
- Everything is stored in
.vscode/laravel-api-client.json in your project — commit it to share with your team, or gitignore it if you keep tokens there.
Getting started
- Open a Laravel project in VS Code.
- Click the
{➤} icon in the Activity Bar.
- Pick a route from the tree — or press the search / table icons to find one — and hit Send.
- In the Environments view, set
base_url to your app (e.g. http://127.0.0.1:8000) and token to a Sanctum/JWT token if your API needs auth.
That's it. The URL, headers, body and auth were already filled in for you.
The config file
.vscode/laravel-api-client.json holds environments and saved requests:
{
"activeEnvironment": "Local",
"environments": {
"Local": { "base_url": "http://127.0.0.1:8000", "token": "" },
"Staging": { "base_url": "https://staging.example.com", "token": "" }
},
"requests": []
}
Edit it directly (gear icon in the Environments view) or through the UI — changes sync both ways.
Settings
| Setting |
Default |
Description |
laravelApiClient.phpPath |
php |
PHP binary used to run artisan |
laravelApiClient.useArtisanRouteList |
true |
Prefer artisan discovery, fall back to static parsing |
laravelApiClient.apiPrefix |
api |
Prefix applied to api.php files in static mode |
laravelApiClient.requestTimeout |
30000 |
Request timeout (ms) |
laravelApiClient.defaultBaseUrl |
http://127.0.0.1:8000 |
Seeds the default environment |
Troubleshooting
Some routes are missing.
Open Output → Laravel API Client. If it says artisan failed and it fell back to static parsing, fix laravelApiClient.phpPath (or your app's .env) — artisan mode is always the most accurate. The static parser covers standard patterns, but prefixes computed at runtime (variables, config values) can't be evaluated statically.
Routes show but requests fail with 419 / CSRF errors.
Session-protected web.php routes reject plain POSTs by design. This client is built for routes/api.php endpoints (Sanctum / JWT / token auth).
{id} appears literally in my URL.
Fill the value under Params → Path Params — the panel warns you if you send with an unfilled placeholder.
HTTPS with a self-signed certificate fails.
Use the http:// dev URL, or a locally-trusted certificate (e.g. valet secure / mkcert).
Privacy
No telemetry, no accounts, no cloud sync, no data collection of any kind. Route data, environments and saved requests live only inside your workspace, and requests go only to the base URL you configure.
License
MIT