andreaselia/laravel-api-to-postman
Auto-generate a Postman collection from your Laravel API routes. Supports Postman schema v2.1, configurable output, bearer token or basic auth for protected routes, and optional scaffolding of FormRequest rules for POST/PUT endpoints.
staging vs. prod tokens).POST/PUT routes, and you want to scaffold request bodies automatically.darkaonline/l5-swagger)."This package automates Postman collection generation from our Laravel API, cutting API documentation time by 80% and reducing errors from manual setup. For example, a 100-route API that took 2 engineers 4 hours to document manually now generates in under a minute—with built-in auth support. It’s a low-cost, high-impact DX improvement that aligns with our security and developer productivity goals."
Key Outcomes:
*"This is a zero-maintenance tool that turns your Laravel routes into a Postman-ready collection. It handles:
- Auth: Bearer/Basic Auth via CLI flags (no manual header setup).
- Request Bodies: Auto-scaffolds
POST/PUTpayloads fromFormRequestvalidation rules.- Organization: Groups routes by middleware (e.g.,
auth:sanctum) for logical separation.How to use it:
- Install:
composer require andreaselia/laravel-api-to-postman.- Configure: Publish the
api-postman.phpfile to tweak output (e.g., disable form data).- Export:
php artisan export:postman --bearer="your_token".Pro Tip: Add this to your CI pipeline to auto-generate collections after deployments. Example GitHub Actions workflow:
- name: Generate Postman Collection run: php artisan export:postman --bearer="${{ secrets.API_TOKEN }}" ```"*
Trade-offs:
How can I help you explore Laravel packages today?