PHPackages                             swanflutter/laravel-api-snapshot - 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. swanflutter/laravel-api-snapshot

ActiveLibrary[API Development](/categories/api)

swanflutter/laravel-api-snapshot
================================

A professional Laravel package that scans all API routes and generates a Postman Collection v2.1 JSON — with FormRequest validation extraction, fake sample values, Persian/English descriptions, and flexible grouping.

v1.2.0(1mo ago)03↓85.7%MITPHPPHP ^8.1

Since Jun 5Pushed 1mo agoCompare

[ Source](https://github.com/SwanFlutter/laravel-api-snapshot)[ Packagist](https://packagist.org/packages/swanflutter/laravel-api-snapshot)[ Docs](https://github.com/swanflutter/laravel-api-snapshot)[ RSS](/packages/swanflutter-laravel-api-snapshot/feed)WikiDiscussions main Synced 1w ago

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

Laravel API Snapshot
====================

[](#laravel-api-snapshot)

[![PHP Version](https://camo.githubusercontent.com/6f61c16385e121f1009c477296e9a88d9352813581b8b66a97fed5237b222457/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545382e312d3838393242462e7376673f7374796c653d666c61742d737175617265)](https://php.net/)[![Laravel](https://camo.githubusercontent.com/cebba73645a12a9c8b9f1dc94a46cae6269761529839bac2057097e4840f2de7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d3130253230253743253230313125323025374325323031322d4646324432302e7376673f7374796c653d666c61742d737175617265)](https://laravel.com)[![License: MIT](https://camo.githubusercontent.com/1b01ef0024ba0866c115986b895301f657c1b21fc29f05c4844b7f2e8d89204d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e7376673f7374796c653d666c61742d737175617265)](https://opensource.org/licenses/MIT)[![Packagist](https://camo.githubusercontent.com/e533c54cded8d094c38fc5d3950f8deeea1c7a180ca613aaaa699bab48519197/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7377616e666c75747465722f6c61726176656c2d6170692d736e617073686f742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/swanflutter/laravel-api-snapshot)

**Laravel API Snapshot** scans all your registered API routes and generates a **Postman Collection v2.1 JSON** file automatically — similar to Scribe but focused purely on Postman export.

---

Features
--------

[](#features)

- Zero-config — works out of the box
- Scans all routes filtered by middleware group (default: `api`)
- Groups endpoints by URI prefix: `api/v1/admin/users` → **Admin › User**
- Extracts `FormRequest` validation rules via PHP Reflection (no HTTP lifecycle needed)
- Generates realistic sample/fake values for every parameter type
- Produces path variables, query params, and JSON body in correct Postman format
- Persian/Farsi auto-descriptions (configurable)
- Artisan command with flexible CLI options

---

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

[](#installation)

```
composer require swanflutter/laravel-api-snapshot
```

The service provider is auto-discovered via Laravel's package discovery.

Optionally publish the config:

```
php artisan vendor:publish --tag=api-snapshot-config
```

---

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

[](#quick-start)

```
php artisan api-snapshot:generate
```

Writes `postman_collection.json` to your project root. Import it directly into Postman.

---

Command Options
---------------

[](#command-options)

```
php artisan api-snapshot:generate [options]

  --output=      Output filename          (default: postman_collection.json)
  --name=        Collection name          (default: APP_NAME from .env)
  --base-url=    Base URL for requests    (default: APP_URL from .env)
  --exclude=     Comma-separated URI patterns to exclude
  --group-by=    Grouping: prefix | controller
  --no-persian   Use English descriptions instead of Farsi
  --force        Overwrite without prompting

```

### Examples

[](#examples)

```
# Basic
php artisan api-snapshot:generate

# Custom output and name
php artisan api-snapshot:generate --output=storage/api.json --name="My API"

# Production base URL
php artisan api-snapshot:generate --base-url=https://api.example.com

# Group by controller class
php artisan api-snapshot:generate --group-by=controller

# Exclude specific routes
php artisan api-snapshot:generate --exclude=admin,webhook

# English descriptions
php artisan api-snapshot:generate --no-persian
```

---

Configuration
-------------

[](#configuration)

After publishing, edit `config/api-snapshot.php`:

```
return [
    'name'                => env('APP_NAME') . ' API Documentation',
    'base_url'            => env('APP_URL', 'http://localhost'),
    'output_file'         => 'postman_collection.json',
    'include_middleware'  => ['api'],           // Only scan routes with this middleware
    'exclude_patterns'    => ['telescope', 'horizon', '_debugbar', 'sanctum', 'livewire'],
    'auth'                => ['type' => 'noauth', 'token' => null], // noauth | bearer | basic
    'group_by'            => 'prefix',          // prefix | controller
    'generate_fake_values'=> true,
    'persian_descriptions'=> true,
    'default_headers'     => [
        ['key' => 'Content-Type', 'value' => 'application/json'],
        ['key' => 'Accept',       'value' => 'application/json'],
    ],
];
```

---

How It Works
------------

[](#how-it-works)

### Route Grouping (prefix mode)

[](#route-grouping-prefix-mode)

```
api/v1/admin/users/{id}/status
       │     │
       │     └── sub-group → "User"
       └── top group   → "Admin"

```

### FormRequest Extraction

[](#formrequest-extraction)

For each controller method, the package reflects on its type-hinted parameters to find a `FormRequest`. The `rules()` method is called on an instance created without the HTTP lifecycle, so no real request is needed.

### Parameter Location

[](#parameter-location)

HTTP MethodRules locationGET, DELETEQuery stringPOST, PUT, PATCHJSON body`{param}` in URIPath variable### Fake Value Generation

[](#fake-value-generation)

RuleSample value`email``example@example.com``integer/numeric``16` (respects `min`/`max`)`date/datetime``2026-05-29T08:09:35``boolean``false``in:a,b,c``a` (first value)`url``https://example.com``uuid``550e8400-e29b-41d4-a716-446655440000``nullable` only`null`---

Output Format
-------------

[](#output-format)

The generated JSON is a valid **Postman Collection v2.1**:

```
{
  "variable": [
    {"id": "baseUrl", "key": "baseUrl", "type": "string", "name": "string", "value": "http://localhost"}
  ],
  "info": {
    "name": "My API Documentation",
    "_postman_id": "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx",
    "description": "",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "item": [
    {
      "name": "Admin",
      "description": "",
      "item": [
        {
          "name": "User",
          "description": "",
          "item": [
            {
              "name": "store User",
              "request": {
                "url": {
                  "host": "{{baseUrl}}",
                  "path": "api/v1/admin/users",
                  "query": [],
                  "raw": "{{baseUrl}}/api/v1/admin/users"
                },
                "method": "POST",
                "header": [
                  {"key": "Content-Type", "value": "application/json"},
                  {"key": "Accept",       "value": "application/json"}
                ],
                "body": {
                  "mode": "raw",
                  "raw": {"email": "example@example.com", "password": "Password@123"}
                },
                "description": "این endpoint عملیات «store» را انجام می‌دهد.\n...",
                "auth": {"type": "noauth"}
              },
              "response": []
            }
          ]
        }
      ]
    }
  ]
}
```

---

Requirements
------------

[](#requirements)

- PHP ^8.1
- Laravel 10, 11, or 12

---

License
-------

[](#license)

MIT — see [LICENSE](LICENSE) for details.

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance90

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity43

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

2

Last Release

49d ago

### Community

Maintainers

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

---

Top Contributors

[![SwanFlutter](https://avatars.githubusercontent.com/u/151648897?v=4)](https://github.com/SwanFlutter "SwanFlutter (4 commits)")

---

Tags

apilaraveldocumentationcollectionPostmanformrequestapi-docspostman collectionroute-exporter

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/swanflutter-laravel-api-snapshot/health.svg)

```
[![Health](https://phpackages.com/badges/swanflutter-laravel-api-snapshot/health.svg)](https://phpackages.com/packages/swanflutter-laravel-api-snapshot)
```

###  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)[psalm/plugin-laravel

Psalm plugin for Laravel

3345.3M347](/packages/psalm-plugin-laravel)[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)
