Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Api To Postman

Laravel Api To Postman Laravel Package

andreaselia/laravel-api-to-postman

Automatically generate a Postman collection from your Laravel API routes, with configurable bearer or basic auth support and optional FormRequest scaffolding that publishes validation rules in raw or human-readable form. Run php artisan export:postman to output the collection to storage/app.

View on GitHub
Deep Wiki
Context7

Laravel API to Postman automatically generates a Postman collection from your Laravel API routes, letting you explore and test endpoints without manually building requests. It supports bearer tokens and basic auth for routes behind auth middleware, and can scaffold FormRequest payloads for POST and PUT requests.

  • Generates collections compatible with Postman Schema v2.1.0
  • One-command export via php artisan export:postman
  • Bearer and basic auth support (bearer is favored if both are given)
  • Optional FormRequest rules in raw or human-readable format
  • Publishable config to tailor the export to your needs
Frequently asked questions about Laravel Api To Postman
How do I generate a Postman collection from my Laravel API routes?
Install the package with composer require andreaselia/laravel-api-to-postman, then run php artisan export:postman. The command reflects over Laravel's route collection and writes a Postman Collection v2.1.0 JSON file to storage/app. It is a dev-only tool with no runtime footprint, so it is safe to require with --dev.
How do I install and configure laravel-api-to-postman?
Require the package via Composer, then publish the config with php artisan vendor:publish --provider="AndreasElia\PostmanGenerator\PostmanGeneratorServiceProvider". All options live in a single config/api-postman.php file, which you can edit to match your export requirements. Beyond that config file there are only two CLI flags: --bearer and --basic.
Does this package support bearer token and basic auth in the generated collection?
Yes. Pass --bearer="1|yourToken" or --basic="username:password123" to php artisan export:postman, and the credentials are applied to routes behind an auth middleware. If you supply both flags, bearer auth is favored. Note that auth detection is heuristic, so custom guard names or non-standard middleware aliases may produce collections that silently omit auth.
Which Laravel versions does andreaselia/laravel-api-to-postman support?
The maintainer has kept pace from Laravel 6 through Laravel 13, with the latest release pinning Laravel 13 support via an automated shift pull request. Unsupported versions have been dropped over time, so check the release notes before assuming compatibility with an older app. Because it is a dev-only package, it does not affect your production dependency tree.
How do I include FormRequest validation rules in the generated Postman request bodies?
For POST and PUT routes that use a FormRequest, the package can optionally scaffold the request body from your rules. You enable this in config/api-postman.php and can publish the rules in either raw or human-readable format. This FormRequest scaffolding is the main differentiator versus hand-maintained Postman collections.
Where does export:postman write the JSON file, and can I change the output path?
By default the generated collection is published to the storage/app directory. The output path and other export behavior are controlled through the published config/api-postman.php file. The deterministic output location makes it straightforward to pick up as an artifact in a script or CI job.
Can I run the Postman export in a CI pipeline?
Yes. It is a single Artisan command with deterministic output and a non-zero exit code on failure, so it drops into a CI job the same day you evaluate it. There is no database, queue, or external service dependency. The main decision is policy rather than engineering: whether the artifact is committed, git-ignored, or CI-only, and who owns it.
Is it safe to commit the generated Postman collection when it contains a bearer token?
No. The --bearer and --basic flags write literal credentials into the generated JSON, so committing that file or uploading it as a CI artifact leaks secrets into build history. Treat this as a governance risk rather than a code bug and keep the artifact git-ignored or ephemeral. Also decide up front who is accountable for rotating any credential that reaches it.
Why are some of my API routes missing from the generated collection, or why does the command fail?
Generation depends on reflecting controller actions and serialized closures, so dynamic, attribute-based, or closure-heavy route definitions can degrade or throw. Historically the maintainer has patched issues around serialized closures, class-based rules in arrays, custom rules, and URI naming. Test against your real route shapes and verify protected routes with a staging token rather than trusting the generated JSON.
Does this package generate OpenAPI or Swagger specs, and what are the alternatives?
No. It emits Postman Collection v2.1.0 only, with no OpenAPI or Swagger output and no environment or baseUrl templating. If your team standardizes on OpenAPI, you will need a separate generator such as Scribe or an annotation-driven spec tool. Teams that only need a Postman client of record can use this package as a tactical productivity utility with a named internal owner.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo
bernskioldmedia/laravel-harvest
bernskiold/laravel-data-scrubber
bernskiold/laravel-currency-converter
bernskiold/laravel-campaign-monitor
bernskioldmedia/laravel-autotranslate
siberfx/telegram-bot
roy-sandip/laravel-view-extended
gregsphotography/site-builder-core
roy-sandip/laravel-view
anodyne/blade-fluentui-icons
webx-ui/module-catalog-collections