API Tester
super-admin-org/api-tester lists your API routes and sends requests to them from the admin panel, optionally logged in as a given user, and shows the status, headers, cookies and the formatted response.
| Package | super-admin-org/api-tester |
| Admin URL | /admin/api-tester |
| Menu | Api tester |
| Permission | ext.api-tester (path /api-tester*) |
Installation
composer require super-admin-org/api-tester
php artisan vendor:publish --tag=api-tester # Prism syntax highlighter
php artisan admin:import api-tester
Laravel 11 and newer do not load routes/api.php until you enable it:
php artisan install:api
Without API routes the Routes list is empty.
Using it
- Click a route on the left (filter with the search box). Its method and URI fill the request form; parameters documented with
@SWG\Parameterannotations are added automatically. - Login as: a user id (or what your
user_retrieveraccepts). The request runs as that user on the configured guard. - Add param adds key/value pairs; the upload icon switches a value to a file.
- Send. The response panel shows the status, the body (JSON pretty-printed), headers and cookies.
Requests are handled inside the application (no real HTTP call), so they skip the network and see the same configuration as the panel.
Configuration
'extensions' => [
'api-tester' => [
'prefix' => 'api', // routes whose URI starts with this are listed
'guard' => 'api', // guard used for "Login as"; Laravel 11+ with Sanctum: 'sanctum'
// Optional: resolve the user for "Login as". Use a static method, not a closure,
// so that `php artisan config:cache` keeps working.
'user_retriever' => [\App\Support\ApiTesterUsers::class, 'find'],
],
],
Compatibility
| Laravel | PHP | State |
|---|---|---|
| 8 – 13 | 8.0+ | Known issue: if an API controller method has a doc comment, the page fails with "Call to undefined function array_get()" (the helper was removed in Laravel 6). A fix is planned. |
Powerful tool
"Login as" lets the user act as any API user. Grant ext.api-tester only to trusted administrators and disable the extension in production ('enable' => false).