PHPackages                             programmersbeats/postman-generator - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. programmersbeats/postman-generator

ActiveLibrary[API Development](/categories/api)

programmersbeats/postman-generator
==================================

Generate Postman collections from Laravel routes with nested folder structure, browser-based API documentation, Sanctum authentication support, and multiple grouping strategies

v1.0.6(3mo ago)141MITPHPPHP ^8.1|^8.2|^8.3

Since Apr 10Pushed 1mo agoCompare

[ Source](https://github.com/ProgrammersBeats/postman-collection-generator)[ Packagist](https://packagist.org/packages/programmersbeats/postman-generator)[ RSS](/packages/programmersbeats-postman-generator/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependencies (5)Versions (8)Used By (0)

 [![Laravel Postman Collection Generator](src/assets/images/banner.png)](src/assets/images/banner.png)

 [![Latest Version on Packagist](https://camo.githubusercontent.com/706b79267126d955912a121e9553ae8b34f752eef2e6c563e45ff471d36872b5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f70726f6772616d6d65727362656174732f706f73746d616e2d67656e657261746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/programmersbeats/postman-generator) [![Total Downloads](https://camo.githubusercontent.com/6377b02abda4ef95693a9df5a3ff05800887172e3db676aef1490cce4edbf3eb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f70726f6772616d6d65727362656174732f706f73746d616e2d67656e657261746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/programmersbeats/postman-generator) [![License](https://camo.githubusercontent.com/664ff1120052729f152c836cd8b8e506b009f1b461f2e90e7192504acff12536/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f70726f6772616d6d65727362656174732f706f73746d616e2d67656e657261746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/programmersbeats/postman-generator)

 The most advanced Laravel Postman collection generator.
 **Import and start testing immediately** - zero manual configuration required.

Why This Package?
-----------------

[](#why-this-package)

Existing packages generate a JSON file and leave you to configure everything manually. This package generates a **production-ready collection** with auto-generated test scripts, realistic sample data from your factories, example API responses, and a beautiful browser documentation page - all working out of the box.

### What Makes This Different

[](#what-makes-this-different)

FeatureThis PackageOthersAuto-generated Postman **test scripts** per endpointYesNoExample **response bodies** from API ResourcesYesNoRealistic request data from **Model Factories**YesNo**Zero-config environment** (auto-detects APP\_URL)YesNo**API Changelog** command (`postman:diff`)YesNo**Browser documentation** page with cURL copyYesNo**Nested folder** structure from route prefixesYesPartial**cURL commands** generated per endpointYesNo**Rate limit** documentation from throttle middlewareYesNo6 grouping strategiesYes1-3Interactive CLI with Laravel PromptsYesPartialRequirements
------------

[](#requirements)

- PHP 8.1+
- Laravel 10.x, 11.x, 12.x, or 13.x

Installation
------------

[](#installation)

```
composer require programmersbeats/postman-generator --dev
```

```
php artisan vendor:publish --tag=postman-generator-config
```

Quick Start
-----------

[](#quick-start)

```
# Generate a single collection file (ready to import)
php artisan postman:collection --Bearer -n
```

**That's it.** Import the single file into Postman and start testing. Everything is embedded - no separate environment file needed.

Output files are auto-versioned:

```
storage/postman/neorecruits-api-2026-v1.postman_collection.json   (1st run)
storage/postman/neorecruits-api-2026-v2.postman_collection.json   (2nd run)
storage/postman/neorecruits-api-2026-v3.postman_collection.json   (3rd run)

```

Then visit **`http://your-app.test/api-documentation`** to view your docs in the browser.

---

Feature 1: Auto-Generated Test Scripts
--------------------------------------

[](#feature-1-auto-generated-test-scripts)

Every endpoint in your collection gets **automatic Postman test scripts**. No other package does this.

Generated tests include:

- Status code validation (200, 201, 204 based on HTTP method)
- Response time check (under 2 seconds)
- Content-Type JSON validation
- Response structure validation (data array for index, data object for show)
- Validation error detection for POST/PUT/PATCH
- Auth token validity check for protected routes

Example test script auto-generated for a `GET /api/users` endpoint:

```
pm.test('Status code is 200', function () {
    pm.response.to.have.status(200);
});

pm.test('Response time is acceptable', function () {
    pm.expect(pm.response.responseTime).to.be.below(2000);
});

pm.test('Response is valid JSON', function () {
    pm.response.to.be.json;
});

pm.test('Response has data array (paginated)', function () {
    const json = pm.response.json();
    if (json.data !== undefined) {
        pm.expect(json.data).to.be.an('array');
    }
});
```

Disable with `--no-tests` if not needed.

Feature 2: Example Responses from API Resources
-----------------------------------------------

[](#feature-2-example-responses-from-api-resources)

The package parses your `JsonResource` classes and generates **realistic example response bodies** embedded directly in the collection.

If your controller returns:

```
public function show(User $user): UserResource
{
    return new UserResource($user);
}
```

And your `UserResource` has:

```
public function toArray($request): array
{
    return [
        'id' => $this->id,
        'name' => $this->name,
        'email' => $this->email,
        'created_at' => $this->created_at,
    ];
}
```

The collection will include an example response:

```
{
    "data": {
        "id": 1,
        "name": "John Doe",
        "email": "user@example.com",
        "created_at": "2026-01-15T10:30:00.000000Z"
    }
}
```

Disable with `--no-responses` if not needed.

Feature 3: Realistic Request Data from Model Factories
------------------------------------------------------

[](#feature-3-realistic-request-data-from-model-factories)

Instead of generic `"sample_value"` placeholders, request bodies are populated with **realistic data parsed from your Model Factories**.

If your `UserFactory` has:

```
public function definition(): array
{
    return [
        'name' => fake()->name(),
        'email' => fake()->safeEmail(),
        'password' => Hash::make('password'),
    ];
}
```

The POST body becomes:

```
{
    "name": "John Doe",
    "email": "user@example.com",
    "password": "password123"
}
```

Faker methods are mapped to realistic sample values (100+ methods supported). Disable with `--no-factory`.

Feature 4: Single File, Zero-Config
-----------------------------------

[](#feature-4-single-file-zero-config)

Everything is embedded in **one collection file** - no separate environment file needed. The collection includes your actual `APP_URL` as pre-configured variables:

- `{{base_url}}` - Auto-set to your `APP_URL/api`
- `{{Bearer}}` - Token stored automatically after login
- `{{token_expiry}}` - Token expiry tracking
- `{{app_url}}` - Your application URL

**Import one file -&gt; Start testing.** No configuration steps.

Feature 5: API Changelog (`postman:diff`)
-----------------------------------------

[](#feature-5-api-changelog-postmandiff)

Compare your current routes against the last generated collection to see what changed.

```
php artisan postman:diff
```

Output:

```
+ 3 New Endpoint(s):
  + [POST] api/auth/2fa/enable
  + [POST] api/auth/2fa/confirm
  + [GET]  api/auth/2fa/recovery-codes

- 1 Removed Endpoint(s):
  - [POST] api/auth/verify-email

~ 1 Modified Endpoint(s):
  ~ [PUT] api/users/{user}
      Now requires authentication

Summary:
  Added:    3
  Removed:  1
  Modified: 1
  Total:    24 endpoints

```

Save as markdown report:

```
php artisan postman:diff --output=CHANGELOG-api.md
```

Feature 6: Browser API Documentation
------------------------------------

[](#feature-6-browser-api-documentation)

Visit `/api-documentation` for a beautiful, interactive documentation page.

**Page features:**

- Dark sidebar with collapsible nested folder navigation
- Color-coded HTTP method badges (GET, POST, PUT, PATCH, DELETE)
- Real-time search across all endpoints (press `/` to focus)
- Expandable route cards with full details
- **Copy-as-cURL button** for every endpoint
- **Example response display** inline
- Rate limit information from throttle middleware
- Auth/public route indicators
- Responsive + print support

Feature 7: Nested Folder Structure
----------------------------------

[](#feature-7-nested-folder-structure)

Route prefixes create hierarchical Postman folders:

```
Route::prefix('auth/pin')->group(function () {
    Route::post('set', [PinController::class, 'setPin']);
    Route::put('update', [PinController::class, 'updatePin']);
});

Route::prefix('auth/2fa')->group(function () {
    Route::post('enable', [TwoFactorSetupController::class, 'enable']);
    Route::post('confirm', [TwoFactorSetupController::class, 'confirm']);
});
```

Produces:

```
Auth/
  Pin/
    Set Pin
    Update Pin
  2fa/
    Enable
    Confirm

```

Customize folder names:

```
'grouping' => [
    'folder_names' => [
        'auth'      => 'Authentication',
        'auth/pin'  => 'PIN Management',
        'auth/2fa'  => '2FA Setup',
    ],
],
```

Feature 8: Multi-Route-File Support
-----------------------------------

[](#feature-8-multi-route-file-support)

Automatically discovers routes from all registered files. Works with Laravel 11's `bootstrap/app.php`:

```
->withRouting(
    api: __DIR__.'/../routes/api.php',
    then: function () {
        Route::middleware('api')->prefix('api')
            ->group(base_path('routes/candidate.php'));
        Route::middleware('api')->prefix('api')
            ->group(base_path('routes/admin.php'));
    },
)
```

All routes from every file appear in the collection and documentation.

Feature 9: cURL Commands
------------------------

[](#feature-9-curl-commands)

Every endpoint includes a ready-to-use cURL command in both the Postman collection description and the browser documentation:

```
curl -X POST \
  'http://your-app.test/api/auth/login' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{}'
```

Feature 10: Rate Limit Documentation
------------------------------------

[](#feature-10-rate-limit-documentation)

Throttle middleware is automatically parsed and displayed:

```
Route::middleware('throttle:60,1')->group(function () {
    // Routes here show "60 requests per 1 minute(s)" in docs
});
```

Command Flags
-------------

[](#command-flags)

### `php artisan postman:collection`

[](#php-artisan-postmancollection)

FlagDescription`--Bearer`Include Bearer token authentication with Sanctum pre-scripts`--name=NAME`Set the collection name (default: your app name)`--output=PATH`Set the output directory (default: `storage/postman`)`--strategy=STRATEGY`Grouping strategy: `prefix`, `controller`, `resource`, `name`, `middleware`, `tag``--full`Full documentation mode with all details`--minimal`Minimal mode - just routes, no extra documentation`--no-tests`Disable auto-generated Postman test scripts`--no-responses`Disable example response generation from API Resources`--no-factory`Disable factory-based realistic sample data`-n`Non-interactive mode, skip prompts and use defaults### `php artisan postman:diff`

[](#php-artisan-postmandiff)

FlagDescription`--collection=PATH`Path to existing collection file to compare against`--output=PATH`Save the diff report as a markdown file### Examples

[](#examples)

```
# Full collection with Bearer auth (non-interactive)
php artisan postman:collection --Bearer -n

# Interactive mode - guided setup with prompts
php artisan postman:collection

# Custom name and controller grouping
php artisan postman:collection --Bearer --name="My API v2" --strategy=controller -n

# Minimal collection without test scripts
php artisan postman:collection --Bearer --minimal --no-tests -n

# Compare routes with last generated collection
php artisan postman:diff

# Save API changelog as markdown
php artisan postman:diff --output=API-CHANGELOG.md
```

Grouping Strategies
-------------------

[](#grouping-strategies)

StrategyDescription`prefix` (default)Nested folders from URL prefixes`controller`Group by controller class`resource`CRUD operations grouped with proper ordering`name`Group by route name prefix`middleware`Group by middleware (auth, guest, etc.)`tag`Group by PHPDoc `@tag` or `@group` annotationsConfiguration
-------------

[](#configuration)

```
// config/postman-generator.php

'features' => [
    'test_scripts' => true,        // Auto-generate Postman test scripts
    'example_responses' => true,    // Generate example responses from Resources
    'factory_data' => true,         // Use Factory data for request bodies
],

'documentation' => [
    'enabled' => true,
    'route' => 'api-documentation',
    'middleware' => ['web'],
],

'grouping' => [
    'default' => 'prefix',
    'folder_names' => [
        // 'auth/pin' => 'PIN Management',
    ],
],
```

Publishing &amp; Customization
------------------------------

[](#publishing--customization)

```
php artisan vendor:publish --tag=postman-generator-config
php artisan vendor:publish --tag=postman-generator-views
php artisan vendor:publish --tag=postman-generator-stubs
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Security
--------

[](#security)

If you discover any security-related issues, please email  instead of using the issue tracker.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

Credits
-------

[](#credits)

- [Ameer Hamza](https://github.com/ProgrammersBeats)
- [All Contributors](../../contributors)

Support
-------

[](#support)

If you find this package helpful, consider supporting [ProgrammersBeats](https://github.com/ProgrammersBeats) by starring the repository and sharing it with your network.

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance85

Actively maintained with recent releases

Popularity11

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

7

Last Release

105d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a0d110508bb9e8186be595b5fe5be45094fd79a5e8751744be9a54ccd31ffbb3?d=identicon)[ProgrammersBeats](/maintainers/ProgrammersBeats)

---

Top Contributors

[![AmeerHamza-AH](https://avatars.githubusercontent.com/u/98511209?v=4)](https://github.com/AmeerHamza-AH "AmeerHamza-AH (20 commits)")

---

Tags

apilaraveldocumentationgeneratorcollectionsanctumPostmanapi-documentationnested-folders

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/programmersbeats-postman-generator/health.svg)

```
[![Health](https://phpackages.com/badges/programmersbeats-postman-generator/health.svg)](https://phpackages.com/packages/programmersbeats-postman-generator)
```

###  Alternatives

[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

77922.3M186](/packages/laravel-mcp)[andreaselia/laravel-api-to-postman

Generate a Postman collection automatically from your Laravel API

1.0k644.5k4](/packages/andreaselia-laravel-api-to-postman)[laravel/surveyor

Static analysis tool for Laravel applications.

86121.4k14](/packages/laravel-surveyor)[api-platform/laravel

API Platform support for Laravel

58174.6k17](/packages/api-platform-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
