PHPackages                             ahmedtarboush/papyrus-docs - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. ahmedtarboush/papyrus-docs

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

ahmedtarboush/papyrus-docs
==========================

A native, reflection-based documentation generator for Laravel. Turns your code into a living codex.

v1.0.0(4mo ago)0894MITJavaScriptPHP ^8.2CI passing

Since Feb 21Pushed 2w agoCompare

[ Source](https://github.com/ahmedaymantarboush/papyrus-docs)[ Packagist](https://packagist.org/packages/ahmedtarboush/papyrus-docs)[ Docs](https://github.com/ahmedaymantarboush/papyrus-docs)[ RSS](/packages/ahmedtarboush-papyrus-docs/feed)WikiDiscussions main Synced 2d ago

READMEChangelogDependencies (7)Versions (2)Used By (0)

 **¶ PAPYRUS DOCS**

 *A Postman-like API documentation &amp; testing client — natively inside Laravel.*

 [![Packagist Version](https://camo.githubusercontent.com/06e69935a755c052b5a8e042998ce16bc2be1ab87bbda3a092efbcaf5e70a313/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f61686d6564746172626f7573682f706170797275732d646f63733f7374796c653d666c61742d737175617265266c6162656c3d7061636b616769737426636f6c6f723d663539653062)](https://camo.githubusercontent.com/06e69935a755c052b5a8e042998ce16bc2be1ab87bbda3a092efbcaf5e70a313/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f61686d6564746172626f7573682f706170797275732d646f63733f7374796c653d666c61742d737175617265266c6162656c3d7061636b616769737426636f6c6f723d663539653062) [![PHP 8.1+](https://camo.githubusercontent.com/f300b22ba00aa3a0ef67aaab5765489aef8759bc5cdb9af55c0526a00fd80962/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e312532422d3737374242343f7374796c653d666c61742d737175617265266c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://camo.githubusercontent.com/f300b22ba00aa3a0ef67aaab5765489aef8759bc5cdb9af55c0526a00fd80962/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e312532422d3737374242343f7374796c653d666c61742d737175617265266c6f676f3d706870266c6f676f436f6c6f723d7768697465) [![Laravel](https://camo.githubusercontent.com/acb0f21aed6d1cd466c29883c82a4070564bb4ab727be013d28fecb69d7efac3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d31302532307c25323031312532307c25323031322d4646324432303f7374796c653d666c61742d737175617265266c6f676f3d6c61726176656c266c6f676f436f6c6f723d7768697465)](https://camo.githubusercontent.com/acb0f21aed6d1cd466c29883c82a4070564bb4ab727be013d28fecb69d7efac3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d31302532307c25323031312532307c25323031322d4646324432303f7374796c653d666c61742d737175617265266c6f676f3d6c61726176656c266c6f676f436f6c6f723d7768697465) [![React](https://camo.githubusercontent.com/f891128b5819422b0f60a650ec4386b682dc2c6122717cc7540518252f6436e1/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f52656163742d31382d3631444146423f7374796c653d666c61742d737175617265266c6f676f3d7265616374266c6f676f436f6c6f723d626c61636b)](https://camo.githubusercontent.com/f891128b5819422b0f60a650ec4386b682dc2c6122717cc7540518252f6436e1/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f52656163742d31382d3631444146423f7374796c653d666c61742d737175617265266c6f676f3d7265616374266c6f676f436f6c6f723d626c61636b) [![License](https://camo.githubusercontent.com/83cacd6f26c5d071557db56c95d2e48ea5c4e4ddb476a00aaf15ee03fecde024/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f61686d6564746172626f7573682f706170797275732d646f63733f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/83cacd6f26c5d071557db56c95d2e48ea5c4e4ddb476a00aaf15ee03fecde024/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f61686d6564746172626f7573682f706170797275732d646f63733f7374796c653d666c61742d737175617265)

---

What is Papyrus?
----------------

[](#what-is-papyrus)

Papyrus Docs is an **enterprise-grade API documentation and playground** that lives inside your Laravel application. It automatically reads your `FormRequest` validation rules — including nested arrays, Enum options, file uploads, and conditional rules — and renders them as an interactive, Postman-like testing UI with zero configuration.

**No OpenAPI YAML. No manual annotations. Just write your FormRequests, and Papyrus does the rest.**

### Why Papyrus?

[](#why-papyrus)

FeaturePostmanSwagger UI**Papyrus**Zero-config from FormRequest❌❌✅Recursive nested objects/arrays❌Partial✅Two-Way Visual ↔ JSON sync❌❌✅Dynamic Enum / Select detection❌Manual✅Inline key editing &amp; type morphing❌❌✅File upload + FormData auto-handling✅❌✅Lives inside your Laravel app❌❌✅---

Features at a Glance
--------------------

[](#features-at-a-glance)

- **🧠 Exhaustive Validation Engine** — Parses every Laravel 12 rule: `required`, `nullable`, `min`, `max`, `regex`, `between`, `confirmed`, `dimensions`, conditional rules (`required_if`, `prohibited_unless`), and more.
- **🔍 Dynamic Type Discovery** — Rules like `uuid`, `ulid`, `ip`, `mac_address` are dynamically registered as custom types with format-specific UI hints.
- **📋 Enum &amp; Options Extraction** — Automatically extracts `in:a,b,c`, `Rule::in()`, and PHP 8.1+ Enum cases into selectable dropdowns.
- **🔄 Two-Way Sync** — Edit payload via Visual Form or Raw JSON — changes sync bidirectionally with a file-guard safety mechanism.
- **☑️ Postman Checkbox** — Toggle individual fields on/off. Disabled fields are excluded from the request but preserved in state.
- **✏️ Inline Key Editor** — Click any key to rename it. Add/remove custom properties dynamically.
- **🔁 Recursive Form Engine** — Infinite nesting via `DynamicField` → `ObjectBuilder` → `ArrayBuilder` → `DynamicField`.
- **📝 Non-Truncated Validation Badges** — All rules displayed as expandable badges, never truncated.
- **🔧 DocBlock Overrides** — Absolute manual control with powerful custom directives like `@papyrus-bodyParam`, `@papyrus-queryParam`, `@papyrus-header`, and multi-line markdown blocks for `@papyrus-description-start` and `@papyrus-responseExample-start`.
- **📡 Code Snippets** — Auto-generated cURL, PHP (Guzzle), JavaScript (fetch), and Python (requests) snippets for every endpoint.
- **📦 FormData Auto-Handling** — File uploads automatically switch to `multipart/form-data` with correct boundary headers.
- **⚙️ Configurable Grouping** — Group endpoints by controller, route name, or URI regex patterns.
- **🎨 Global Dark &amp; Light Mode** — Fully responsive dark theme that defaults to your OS preference.
- **🎯 OpenAPI Export** — Export your documentation as OpenAPI 3.0 JSON specification.
- **📮 Postman Export** — Export as Postman Collection v2.1 for team sharing.
- **🛡️ Authorization Gate** — Built-in `viewPapyrusDocs` gate for access control.
- **🐛 Debug Mode** — Debug headers with execution time, memory usage, PHP and Laravel versions.
- **🔧 Artisan Commands** — `papyrus:install` for one-step setup.

---

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

[](#installation)

### 1. Require the package

[](#1-require-the-package)

```
composer require ahmedtarboush/papyrus-docs --dev
```

### 2. Run the install command (recommended)

[](#2-run-the-install-command-recommended)

```
php artisan papyrus:install
```

This publishes both the config file and production assets in one step.

### 3. Or publish manually

[](#3-or-publish-manually)

```
# Config only
php artisan vendor:publish --tag=papyrus-config

# Assets only (for production)
php artisan vendor:publish --tag=papyrus-assets
```

### 4. Access the dashboard

[](#4-access-the-dashboard)

Navigate to:

```
http://your-app.test/papyrus-docs

```

> **That's it.** No annotations required. Papyrus automatically scans your routes and FormRequests.

---

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

[](#quick-start)

### Step 1: Create a FormRequest

[](#step-1-create-a-formrequest)

```
class StoreUserRequest extends FormRequest
{
    public function rules(): array
    {
        return [
            'name'     => 'required|string|max:255',
            'email'    => 'required|email|unique:users',
            'age'      => 'nullable|integer|min:18|max:120',
            'role'     => ['required', Rule::in(['admin', 'editor', 'viewer'])],
            'avatar'   => 'nullable|image|max:5120|extensions:jpg,png,webp',
            'tags'     => 'array',
            'tags.*'   => 'string|max:50',
        ];
    }
}
```

### Step 2: Type-hint it in your controller

[](#step-2-type-hint-it-in-your-controller)

```
/**
 * Register a new user.
 *
 * Creates a user account with the provided details,
 * profile picture, and role assignment.
 *
 * @group Users
 */
public function store(StoreUserRequest $request)
{
    // ...
}
```

### Step 3: Open Papyrus

[](#step-3-open-papyrus)

Visit `/papyrus-docs` in your browser. The endpoint above will appear with:

- All fields rendered with correct input types (email field, number with min/max, file upload with `.jpg,.png,.webp` accept filter)
- `role` rendered as a Select dropdown with `admin`, `editor`, `viewer`
- `tags` rendered as a repeatable array builder
- Validation badges showing `required`, `string`, `max:255` on each field
- A fully functional playground to test the endpoint with real requests

---

Documentation
-------------

[](#documentation)

DocDescription[Configuration](docs/1-configuration.md)Every config key explained[Validation Engine](docs/2-validation-engine.md)How FormRequest rules become UI components[Custom Directives](docs/3-custom-directives.md)DocBlock overrides &amp; `@papyrus-bodyParam`[Smart UI Guide](docs/4-smart-ui.md)Two-Way Sync, Postman Checkbox, Inline Editor---

Artisan Commands
----------------

[](#artisan-commands)

### `papyrus:install`

[](#papyrusinstall)

One-step installation that publishes both config and assets:

```
php artisan papyrus:install
```

Equivalent to running:

```
php artisan vendor:publish --tag=papyrus-config
php artisan vendor:publish --tag=papyrus-assets
```

### `papyrus:export`

[](#papyrusexport)

Export your API schema directly to a JSON file (uses `config('papyrus.export_path')`):

```
# Export OpenAPI 3.0 (default)
php artisan papyrus:export

# Export Postman Collection v2.1
php artisan papyrus:export --type=postman
```

---

Exporters
---------

[](#exporters)

### OpenAPI 3.0 Export

[](#openapi-30-export)

Papyrus includes an `OpenApiGenerator` that converts your scanned routes into an OpenAPI 3.0 specification:

```
use AhmedTarboush\PapyrusDocs\Exporters\OpenApiGenerator;
use AhmedTarboush\PapyrusDocs\PapyrusGenerator;

$schema = app(PapyrusGenerator::class)->scan();
$openApi = (new OpenApiGenerator())->generate($schema);

// Returns a complete OpenAPI 3.0 spec array with:
// - info (title, version)
// - paths (with tags, summary, description, requestBody, responses)
```

Configure the export via `config/papyrus.php` under the `open_api` key.

### Postman Collection Export

[](#postman-collection-export)

The `PostmanGenerator` exports your API as a Postman Collection v2.1:

```
use AhmedTarboush\PapyrusDocs\Exporters\PostmanGenerator;
use AhmedTarboush\PapyrusDocs\PapyrusGenerator;

$schema = app(PapyrusGenerator::class)->scan();
$postman = (new PostmanGenerator())->generate($schema);

// Returns a Postman v2.1 collection with:
// - info (name, schema URL)
// - item[] (grouped by API group, with name, request, body)
```

Import the resulting JSON directly into Postman to share with your team.

---

Debug Mode
----------

[](#debug-mode)

Enable debug mode to get execution metadata in the schema API response headers:

```
PAPYRUS_DEBUG=true
```

The `/papyrus-docs/api/schema` endpoint will include:

HeaderDescription`X-Papyrus-Debug-Time-Ms`Schema generation time in milliseconds`X-Papyrus-Debug-Memory-Mb`Memory consumed during generation`X-Papyrus-Debug-PHP`PHP version`X-Papyrus-Debug-Laravel`Laravel version---

Authorization
-------------

[](#authorization)

By default, Papyrus is only accessible in `local` and `testing` environments via the `viewPapyrusDocs` gate.

The default gate definition:

```
Gate::define('viewPapyrusDocs', function ($user = null) {
    return app()->environment('local', 'testing');
});
```

To customize access, override the gate in your `AuthServiceProvider`:

```
Gate::define('viewPapyrusDocs', function ($user = null) {
    return $user && $user->isAdmin();
});
```

---

Internal Routes
---------------

[](#internal-routes)

Papyrus registers these routes under the configured URL prefix:

RoutePurpose`GET /papyrus-docs`The SPA UI (gated by `viewPapyrusDocs`)`GET /papyrus-docs/api/schema`JSON schema endpoint (used by the UI)`GET /papyrus-docs/assets/{path}`Static asset serving (JS, CSS, fonts)`GET /papyrus-docs/favicon/{file?}`Favicon servingAll routes respect the `middlewares` config and are prefixed with the `url` config value.

---

Disabling in Production
-----------------------

[](#disabling-in-production)

Set the environment variable:

```
PAPYRUS_ENABLED=false
```

This prevents all Papyrus routes from being registered. The ServiceProvider short-circuits entirely.

---

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

[](#requirements)

- PHP 8.1+
- Laravel 10, 11, or 12
- `phpdocumentor/reflection-docblock` (auto-installed)

---

Created By
----------

[](#created-by)

**Ahmed Tarboush** — [LinkedIn](https://www.linkedin.com/in/ahmed-tarboush/)

---

License
-------

[](#license)

Papyrus Docs is open-source software licensed under the [MIT License](LICENSE).

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance88

Actively maintained with recent releases

Popularity17

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity47

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

Unknown

Total

1

Last Release

133d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/112106879?v=4)[ahmedtarboush](/maintainers/ahmedtarboush)[@AhmedTarboush](https://github.com/AhmedTarboush)

---

Top Contributors

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

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/ahmedtarboush-papyrus-docs/health.svg)

```
[![Health](https://phpackages.com/badges/ahmedtarboush-papyrus-docs/health.svg)](https://phpackages.com/packages/ahmedtarboush-papyrus-docs)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.6k29.9M146](/packages/laravel-cashier)[craftcms/cms

Craft CMS

3.6k3.6M3.1k](/packages/craftcms-cms)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k15.1M132](/packages/laravel-pulse)[hasinhayder/tyro-dashboard

Tyro Dashboard - Beautiful admin dashboard for managing Tyro roles, privileges, users, and settings

5443.8k](/packages/hasinhayder-tyro-dashboard)[api-platform/laravel

API Platform support for Laravel

58171.6k14](/packages/api-platform-laravel)

PHPackages © 2026

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