New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

matijajanc/postman

Postman file generator
174
Install
composer require matijajanc/postman
Latest Version:1.0.0
PHP:^8.0
License:MIT
Last Updated:Nov 2, 2021
Links: GitHub  ·  Packagist
Maintainer: matijajanc

Postman collection generator

Installation

composer require matijajanc/postman

Laravel

Publish config file

php artisan vendor:publish --provider="Matijajanc\Postman\Providers\PostmanServiceProvider"

Lumen

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

Run command to generate Postman files

php artisan postman:generate

This command generates 2 files:

  • postman-environment.json (where variables are defined)
  • postman.json (where all API routes are defined)

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.

Requirements

PHP 8 attributes

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.

Usages

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

Related Packages

kiendaotac/lumen-installer

Lumen application installer.

12 0
appzcoder/lumen-routes-list

Display the route list of Lumen

747,431 117
codeception/module-lumen

Codeception module for Lumen framework

167,947 0
mlntn/lumen-artisan-serve

artisan serve for Lumen projects

100,473 49
cosmicvelocity/lumen-helpers

Improves interoperability between Lumen and Laravel.

65,662 6

Version History

Version Released PHP License
1.0.0 ^8.0 MIT