andreaselia / laravel-api-to-postman
Generate a Postman collection automatically from your Laravel API
Fund package maintenance!
andreaselia
tomirons
Installs: 359 001
Dependents: 3
Suggesters: 0
Security: 0
Stars: 956
Watchers: 20
Forks: 99
Open Issues: 1
Requires
- php: ^7.4|^8.0
- ext-json: *
- illuminate/config: ^7.0|^8.0|^9.0|^10.0|^11.0
- illuminate/console: ^7.0|^8.0|^9.0|^10.0|^11.0
- illuminate/contracts: ^7.0|^8.0|^9.0|^10.0|^11.0
- illuminate/routing: ^7.0|^8.0|^9.0|^10.0|^11.0
- illuminate/support: ^7.0|^8.0|^9.0|^10.0|^11.0
- phpstan/phpdoc-parser: ^1.26
Requires (Dev)
- laravel/pint: ^1.13
- orchestra/testbench: ^8.0|^9.0
- phpunit/phpunit: ^10.0|^11.0
- dev-main
- v2.0.6
- v2.0.5
- v2.0.4
- v2.0.3
- v2.0.2
- v2.0.1
- v2.0.0
- v1.16.0
- v1.15.0
- v1.14.0
- v1.13.0
- v1.12.2
- v1.12.1
- v1.12.0
- v1.11.0
- v1.10.1
- v1.10.0
- v1.9.0
- v1.8.0
- v1.7.10
- v1.7.9
- v1.7.8
- v1.7.7
- v1.7.6
- v1.7.5
- v1.7.4
- v1.7.3
- v1.7.2
- v1.7.1
- v1.7.0
- v1.6.4
- v1.6.3
- v1.6.2
- v1.6.1
- v1.6.0
- v1.5.0
- v1.4.0
- v1.3.0
- v1.2.0
- v1.1.0
- v1.0.0
- dev-2.0-old
This package is auto-updated.
Last update: 2024-10-23 16:05:25 UTC
README
Laravel API to Postman
This package allows you to automatically generate a Postman collection based on your API routes. It also provides basic configuration and support for bearer auth tokens and basic auth for routes behind an auth middleware.
For POST
and PUT
requests that utilizes a FormRequest, you can optionally scaffold the request, and publish rules in raw or human readable format.
Postman Schema
The generator works for the latest version of the Postman Schema at the time of publication (v2.1.0).
Installation
Install the package:
composer require andreaselia/laravel-api-to-postman
Publish the config file:
php artisan vendor:publish --provider="AndreasElia\PostmanGenerator\PostmanGeneratorServiceProvider" --tag="postman-config"
Configuration
You can modify any of the api-postman.php
config values to suit your export requirements.
Click here to view the config attributes.
Usage
The output of the command being ran is your storage/app directory.
To use the command simply run:
php artisan export:postman
The following usage will generate routes with the bearer token specified.
php artisan export:postman --bearer="1|XXNKXXqJjfzG8XXSvXX1Q4pxxnkXmp8tT8TXXKXX"
The following usage will generate routes with the basic auth specified.
php artisan export:postman --basic="username:password123"
If both auths are specified, bearer will be favored.
Examples
This is with the default configuration and a bearer token passed in:
php artisan export:postman --bearer=123456789
Contributing
You're more than welcome to submit a pull request, or if you're not feeling up to it - create an issue so someone else can pick it up.