phpsa/laravel-postman
Generate Postman collections from your Laravel routes automatically. This package scans your API endpoints and exports ready-to-import collections, keeping docs in sync with your codebase.
composer require phpsa/laravel-postman --dev. It never touches the request lifecycle, so there's no production blast radius — the worst case is a wasted afternoon, not a broken deploy.php artisan vendor:publish (list tags and confirm the postman tag exists in this version — the tag name has moved across majors).php artisan list | grep -i postman to get the real command name and flags. Don't trust a blog post; run it.localhost, are requests grouped into folders by prefix, and does the auth block match what your app actually expects.Import → Files into Postman, confirm {{base_url}} resolves, fire one request.FormRequest, one auth-protected route, and one route with a URI parameter. That one slice exercises the three inference paths — URL/method from the route, body from validation rules, auth header from config. If those three come out right, the rest of your API probably will too. If they don't, you've found your ceiling in an hour instead of a week.config/postman.php. Anything you hand-edit in the collection is erased on the next run. If you find yourself patching the output, you've found a config gap or a route that shouldn't be exported."postman": "php artisan export:postman") plus a CI step that publishes the collection as a build artifact. Committing the JSON gives you reviewable drift in PRs; a CI artifact keeps the repo clean but makes drift invisible. Pick deliberately and write the decision down, because the wrong choice surfaces six months later as "why is our Postman collection three API versions stale?"api/v1/* into one collection and api/v2/* into another. One 800-request collection is unreviewable, slow to import, and produces diffs nobody reads. Separate collections per domain (billing, users, admin) also make it clear who owns what.$request->validate([...]) in a controller produces thin or empty request bodies. Extracting rules to a FormRequest is good practice anyway and directly improves the generated output. Same logic for typed controller signatures and API Resources: the more explicitly your code declares its shapes, the better the export.{{token}} from the environment. Rotating a local token then means editing one variable, not N requests — and it means the collection keeps working after a teammate's token expires.{{base_url}} and let developers override locally, or run the generator per environment in CI. Teams that skip this ship a collection where every staging tester hits localhost.Route:: definitions, so it fits naturally into a workflow where the route file is the API contract. Compared to an attribute/annotation-based OpenAPI generator (Scramble, Scribe), you get zero-annotation adoption on an existing app but noticeably less schema fidelity — no oneOf, no realistic examples, weaker response modelling. Choose accordingly: great for "give QA something to click", weaker as a public API contract.{{user_id}}), then reference that variable in downstream requests. This is the difference between a collection reviewers can actually run and one they give up on.v5.1.0...v5.2.0 compare link. Read the diff before pinning, and after any upgrade diff the generated collection.json against the previous run. A silent change to how bodies or auth blocks are emitted is a quiet diff in a file your team imports, not a loud error. Never bump this package in the same PR as another dependency.App::environment() guards, or conditional registration may not exist. Before blaming the package, run php artisan route:list | grep <path> — if it isn't there, the generator can't see it either.sometimes, nullable, required_if, arrays-of-objects, and Rule:: objects all translate imperfectly. Expect to hand-tune a handful of requests. If it's more than a handful, keep a documented list of "requests we patch post-export" rather than silently accepting wrong bodies..gitattributes as linguist-generated so JSON diffs stop appearing in code review.localhost. Confirm the collection uses {{base_url}} and ship an environment file alongside it.vendor/phpsa/laravel-postman after each major bump rather than following tutorials written for v3 or v4. Keeping the integration shallow also means swapping to Scramble or Scribe later is a contained change, not a rewrite.How can I help you explore Laravel packages today?