Laravel Routes to Postman Collection Generator
This package automatically generates postman collection from laravel api/web routes with just a single command
Postman Schema
Supports postman collection Schema v2.1.0
Installation
Install this bundle through Composer:
composer require profclems/postman-collection-generator
Add the PostmanCollectionServiceProvider to providers in the config/app.php
'providers' => [
...
\Profclems\PostmanCollectionGenerator\PostmanCollectionServiceProvider::class,
];
Usage
To generate collection for api routes, run
php artisan postman:collection:export NameForCollection --api
This will generate a `
yyyy_mm_dd_his_NameForCollection_api.json`
in your Laravel `
storage/app`
folder.
To generate collection for web routes, run
php artisan postman:collection:export NameForCollection --web
This will generate a `
yyyy_mm_dd_his_NameForCollection_web.json`
in your Laravel `
storage/app`
folder.
Change NameForCollection
to the name you want the collection file saved as.
Options
By default, the url is set to `
{{base_url}}`
which is a postman variable that can be set in your postman environment.
--api or --web to specify the type of route to export
--url to specify the url for the collection. Eg. --url=localhost
--port to specify the port. Eg --port=8000