This package allows you to export your API routes to a postman import json file
Install the package via composer
composer require --dev jimenezmaximiliano/laravel-postman
Then add the service provider in config/app.php:
JimenezMaximiliano\LaravelPostman\LaravelPostmanServiceProvider::class
JimenezMaximiliano\LaravelPostman\LaravelPostmanServiceProvider
First, publish the package configuration file:
php artisan vendor:publish
Note: publishing the configuration file is optional, you can use de default package options.
This is the base URL for your postman routes
default value: config('app.url')
This is the postman collection name
default value: the command will ask for it
This is the postman collection description
default value: the command will ask for it
This is the prefix by which we identify the routes to export
default value: 'api'
This avoids creating routes for HEAD method
default value: true
The directory to which the postman.json file will be exported
Add a property to your entity controller like this:
public $postmanModel = 'App\MyEntityModel';
public function getPostmanParams() { return $this->fillable; }
This array of params will be used to fill POST and PUT urlencoded form data section in postman. The previous method is just an example, you should return the array of params that you want to see in postman.
php artisan laravelPostman:export