Package Data | |
---|---|
Maintainer Username: | matijajanc |
Maintainer Contact: | matija.janc@gmail.com (Matija Janc) |
Package Create Date: | 2021-10-29 |
Package Last Update: | 2021-11-02 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-24 15:07:10 |
Package Statistics | |
---|---|
Total Downloads: | 161 |
Monthly Downloads: | 2 |
Daily Downloads: | 0 |
Total Stars: | 0 |
Total Watchers: | 1 |
Total Forks: | 0 |
Total Open Issues: | 0 |
composer require matijajanc/postman
Publish config file
php artisan vendor:publish --provider="Matijajanc\Postman\Providers\PostmanServiceProvider"
add below line to bootstrap/app.php
$app->register(Matijajanc\Postman\Providers\PostmanLumenServiceProvider::class);
Publish config file
cp vendor/matijajanc/postman/config/postman.php config/postman.php
php artisan postman:generate
This command generates 2 files:
Currently it supports bearer token authorization, if you have other wishes please create new issue or pull request on github and I'll add/extend it.
I used new PHP 8 attributes feature to define new properties I use for postman file generator. This is not needed to define for GET, DELETE routes, you provide this Postman attribute only where you want your custom request payload POST, PUT.
If no method is provided it calls default factory "definition" method
#[Postman(['factory' => ContractFactory::class])]
public function createContract(Request $request): JsonResponse
You can override which methods get called with additional "method" property
#[Postman(['factory' => ContractFactory::class, 'method' => 'postCreateContract'])]
public function createContract(Request $request): JsonResponse
You can override body type with property "mode"
#[Postman(['factory' => ContractFactory::class, 'method' => 'postCreateContract', 'mode' => 'raw'])]
public function createContract(Request $request): JsonResponse