Download the PHP package hopheartsceo/laravel-postman-exporter without Composer

On this page you can find all versions of the php package hopheartsceo/laravel-postman-exporter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-postman-exporter

Laravel Postman Exporter

Laravel PHP

Automatically generate Postman Collection v2.1 files and OpenAPI 3.0 specifications from your Laravel application routes, controllers, and FormRequest validations — complete with folder grouping and response examples.


Features


Installation

You can install the package via composer:

Installation from GitHub (Development)

If you haven't published to Packagist yet, add this to your composer.json:

Publish the configuration file:


Usage

Artisan Command

Facade API


Configuration

After publishing, edit config/postman-exporter.php:

Option Type Default Description
base_url string env('APP_URL') Base URL for all requests
default_headers array Accept + Content-Type JSON Default headers on every request
output_path string storage/app/postman-collection.json Default output path
collection_name string App name + " API Collection" Name of the Postman collection
grouping array (see below) Folder grouping configuration
responses array (see below) Response examples configuration
include_web_routes bool false Include non-API routes
postman_api_key string '' Postman API key for uploads
enable_upload bool false Auto-upload after generation

Folder Grouping

Routes are grouped into flat, single-level folders by the first segment of the URI. No nesting is created — every route belongs to exactly one top-level folder.

How it works:

URI Folder
api/users api
api/users/{id} api
auth/login auth
auth/logout auth
status general (fallback)
/{id} general (fallback)

Response Examples

Response examples are extracted automatically from your controller methods and attached to each Postman request item.

Or enable at export time with the --with-responses flag:

Response discovery sources:

The exporter combines distinct HTTP status codes from multiple sources instead of stopping at the first match. When two sources describe the same status, the earlier explicit source wins.

  1. PHPDoc @response — Parses one or more @response tags with optional status codes:

  2. API Resource — Detects direct Resource returns and builds response schemas from the Resource's toArray() structure.

  3. Direct Laravel responses — Parses inline response()->json([...], 200) and response()->noContent() returns, including their status codes.

  4. Response Pipeline Tracing — Follows custom $this->helper(...), inherited/trait helpers, and static response helper methods until it reaches response()->json(...) or response()->noContent().

  5. Eloquent Model — Detects return User::find(...) patterns and generates example data from the model's $fillable fields.

  6. Fallback — Uses the configured fallback status and body. By default, the body is null so unknown responses are not documented as fabricated success payloads.

Response pipelines are analyzed statically. Controller endpoints and response helpers are not executed during export or contract checks.

When validation rules are detected, the exporter also adds Laravel's default JSON 422 validation-error contract. This inference is skipped when a FormRequest overrides failedValidation(), and it can be disabled with responses.framework_validation_errors.

Generated response format in Postman:

Route Filters

Middleware to Headers Map


Example Output

The generated collection follows the Postman Collection v2.1 schema. Folders are flat (single-level) and each request includes response examples:

See examples/sample-collection.json for a full example with multiple folders and response examples.


🧪 Testing


🏗️ Architecture

Service Responsibility
RouteScannerService Scans Laravel routes via the Router; extracts return types, PHPDoc, and API Resource usage
RequestAnalyzerService Extracts FormRequest/inline validation rules
ValidationParserService Parses validation rules into structured format
ExampleDataGeneratorService Generates realistic sample values
FolderOrganizerService Groups routes into flat, single-level folders by first URI segment
ResponseExtractorService Analyzes controller methods to extract response structures (PHPDoc → API Resource → JSON → Model → Fallback)
ExampleResponseGeneratorService Converts extracted response data into Postman-formatted response arrays
PostmanCollectionBuilderService Builds Postman v2.1 JSON structure with folders and response examples
PostmanUploaderService Uploads collections to Postman API

Requirements


License

MIT License. See LICENSE for details.


All versions of laravel-postman-exporter with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/support Version ^10.0|^11.0|^12.0|^13.0
illuminate/routing Version ^10.0|^11.0|^12.0|^13.0
illuminate/console Version ^10.0|^11.0|^12.0|^13.0
illuminate/http Version ^10.0|^11.0|^12.0|^13.0
guzzlehttp/guzzle Version ^7.0
nikic/php-parser Version ^5.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package hopheartsceo/laravel-postman-exporter contains the following files

Loading the files please wait ...