PHPackages                             fnematov/scramble-laravel-data - 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. fnematov/scramble-laravel-data

ActiveLibrary[API Development](/categories/api)

fnematov/scramble-laravel-data
==============================

Automatic generation of API documentation for Laravel applications.

1.0.1(yesterday)01↑2900%MITPHPPHP ^8.1

Since Mar 9Pushed yesterdayCompare

[ Source](https://github.com/fnematov/scramble-laravel-data)[ Packagist](https://packagist.org/packages/fnematov/scramble-laravel-data)[ Docs](https://github.com/fnematov/scramble-laravel-data)[ GitHub Sponsors](https://github.com/romalytvynenko)[ RSS](/packages/fnematov-scramble-laravel-data/feed)WikiDiscussions main Synced today

READMEChangelog (2)Dependencies (18)Versions (3)Used By (0)

 [ ![Scramble – Laravel API documentation generator](./.github/gh-img.png?v=1) ](https://scramble.dedoc.co)

Scramble for Laravel Data
=========================

[](#scramble-for-laravel-data)

A fork of [dedoc/scramble](https://github.com/dedoc/scramble) that teaches Scramble to understand [spatie/laravel-data](https://github.com/spatie/laravel-data) `Data` classes.

Scramble generates OpenAPI 3.1.0 documentation for a Laravel application straight from your code, without asking you to write PHPDoc annotations. Upstream Scramble infers types from plain PHP, Eloquent models and API resources — but it does not know about `Spatie\LaravelData\Data`, so a `Data` class used as a request payload or returned from a controller ends up documented as a bare object. This fork fills that gap.

> **Heads up:** this fork ships under the `Fnematov\ScrambleLaravelData\` namespace, not `Dedoc\Scramble\`. It registers the same `scramble` config file, views and `/docs/api` routes as upstream, so install one or the other — not both.

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

[](#installation)

```
composer require fnematov/scramble-laravel-data
```

The service provider is auto-discovered. After install you have two routes:

- `/docs/api` — UI viewer for your documentation
- `/docs/api.json` — the OpenAPI document describing your API

By default these are available only in the `local` environment. You can change that [by defining the `viewApiDocs` gate](https://scramble.dedoc.co/usage/getting-started#docs-authorization).

What this fork adds
-------------------

[](#what-this-fork-adds)

### Data classes as request payloads

[](#data-classes-as-request-payloads)

Type-hint a `Data` class on a controller action and its public properties are documented as the request body — or as query parameters for `GET`, `HEAD` and `DELETE` routes.

```
use Spatie\LaravelData\Attributes\Validation\{Email, Max};
use Spatie\LaravelData\Data;

class CreateUserData extends Data
{
    public function __construct(
        public string $name,
        #[Email]
        public string $email,
        #[Max(500)]
        public ?string $bio = null,
    ) {}
}
```

```
public function store(CreateUserData $data): UserData
{
    // ...
}
```

A property is marked **required** unless its type allows `null` or it declares a default value.

If the `Data` class also defines `rules()`, only one schema is produced — the extractor tells Scramble's form-request path to stand down, so you no longer get a duplicated request body.

### Validation attributes become schema constraints

[](#validation-attributes-become-schema-constraints)

Spatie validation attributes are translated into real OpenAPI keywords instead of being dropped:

AttributeOpenAPI output`#[Email]``format: email``#[Url]``format: uri``#[Uuid]` / `#[Ulid]``format: uuid` / `format: ulid``#[IP]`, `#[IPv4]``format: ipv4``#[IPv6]``format: ipv6``#[DateFormat('Y-m-d')]``format: date``#[DateFormat('Y-m-d H:i:s')]``format: date-time``#[Min]`, `#[Max]`, `#[Size]`, `#[Between]``minLength`/`maxLength`, `minimum`/`maximum` or `minItems`/`maxItems`, picked from the property type`#[Regex]``pattern`, with the PHP delimiters stripped`#[Nullable]`nullable type### List and paginated responses

[](#list-and-paginated-responses)

Add the `HasPaginatedResponse` trait to a `Data` class to return documented collection responses:

```
use Fnematov\ScrambleLaravelData\Support\LaravelData\HasPaginatedResponse;
use Spatie\LaravelData\Data;

class UserData extends Data
{
    use HasPaginatedResponse;

    public function __construct(
        public int $id,
        public string $name,
    ) {}
}
```

```
public function index()
{
    return UserData::paginated(User::query()->paginate());
}

public function all()
{
    return UserData::list(User::all());
}
```

`paginated()` documents and returns:

```
{
  "items": [{ "id": 1, "name": "Ada" }],
  "totalCount": 42,
  "totalPages": 3,
  "currentPage": 1,
  "perPage": 15,
  "hasMorePages": true
}
```

`list()` documents and returns `{ "items": [...] }`. The item schema is a `$ref` to the `Data` class, so it is not inlined at every call site.

### Property types Scramble now resolves

[](#property-types-scramble-now-resolves)

- **Backed enums** — rendered as an `enum` of their values, including arrays of enums (`Status[]`), which previously collapsed to `array[string]`
- **`UploadedFile`** and `UploadedFile[]` — `string` with `format: binary` and `contentMediaType: application/octet-stream`
- **Array shapes** from `@var` docblocks — `array{name: string, age?: int}` becomes a real object schema with the right required keys, instead of `array[string]`
- **Collections** — `array`, `T[]`, `DataCollection` and `Collection`
- **Self-referencing `Data` classes** — emitted as a `$ref` rather than nesting forever

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

[](#documentation)

Everything not listed above behaves exactly like upstream Scramble, whose full documentation lives at [scramble.dedoc.co](https://scramble.dedoc.co).

Credits
-------

[](#credits)

Scramble is built by [Roman Lytvynenko](https://github.com/romalytvynenko) and the [dedoc](https://github.com/dedoc) team. This fork only adds the `spatie/laravel-data` layer on top; all credit for the documentation generator itself belongs upstream.

License
-------

[](#license)

MIT. See [LICENSE.md](LICENSE.md).

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance100

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 89.1% 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 ~171 days

Total

2

Last Release

1d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/25400796?v=4)[Farhodjon Nematov](/maintainers/fnematov)[@fnematov](https://github.com/fnematov)

---

Top Contributors

[![romalytvynenko](https://avatars.githubusercontent.com/u/6153876?v=4)](https://github.com/romalytvynenko "romalytvynenko (903 commits)")[![fnematov](https://avatars.githubusercontent.com/u/25400796?v=4)](https://github.com/fnematov "fnematov (19 commits)")[![kburton-dev](https://avatars.githubusercontent.com/u/10101978?v=4)](https://github.com/kburton-dev "kburton-dev (11 commits)")[![WildEgo](https://avatars.githubusercontent.com/u/15840871?v=4)](https://github.com/WildEgo "WildEgo (9 commits)")[![tontonsb](https://avatars.githubusercontent.com/u/16481303?v=4)](https://github.com/tontonsb "tontonsb (8 commits)")[![layerok](https://avatars.githubusercontent.com/u/18424848?v=4)](https://github.com/layerok "layerok (7 commits)")[![chrisvanlier2005](https://avatars.githubusercontent.com/u/93382176?v=4)](https://github.com/chrisvanlier2005 "chrisvanlier2005 (6 commits)")[![manuel-watchenterprise](https://avatars.githubusercontent.com/u/135170518?v=4)](https://github.com/manuel-watchenterprise "manuel-watchenterprise (5 commits)")[![axelrindle](https://avatars.githubusercontent.com/u/7105632?v=4)](https://github.com/axelrindle "axelrindle (4 commits)")[![apasquini95](https://avatars.githubusercontent.com/u/110283751?v=4)](https://github.com/apasquini95 "apasquini95 (4 commits)")[![princejohnsantillan](https://avatars.githubusercontent.com/u/60916966?v=4)](https://github.com/princejohnsantillan "princejohnsantillan (4 commits)")[![Neorej](https://avatars.githubusercontent.com/u/18243173?v=4)](https://github.com/Neorej "Neorej (3 commits)")[![dbrekelmans](https://avatars.githubusercontent.com/u/9531344?v=4)](https://github.com/dbrekelmans "dbrekelmans (3 commits)")[![Wojtazzzz](https://avatars.githubusercontent.com/u/77293179?v=4)](https://github.com/Wojtazzzz "Wojtazzzz (2 commits)")[![AlexSabur](https://avatars.githubusercontent.com/u/12692865?v=4)](https://github.com/AlexSabur "AlexSabur (2 commits)")[![BlackLanzer](https://avatars.githubusercontent.com/u/6444180?v=4)](https://github.com/BlackLanzer "BlackLanzer (2 commits)")[![chaikivskyi](https://avatars.githubusercontent.com/u/32939927?v=4)](https://github.com/chaikivskyi "chaikivskyi (2 commits)")[![ferdinandfrank](https://avatars.githubusercontent.com/u/19409640?v=4)](https://github.com/ferdinandfrank "ferdinandfrank (2 commits)")[![finalgamer](https://avatars.githubusercontent.com/u/6725516?v=4)](https://github.com/finalgamer "finalgamer (2 commits)")[![jrdnrc](https://avatars.githubusercontent.com/u/1749312?v=4)](https://github.com/jrdnrc "jrdnrc (2 commits)")

---

Tags

laraveldocumentationopenapi

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/fnematov-scramble-laravel-data/health.svg)

```
[![Health](https://phpackages.com/badges/fnematov-scramble-laravel-data/health.svg)](https://phpackages.com/packages/fnematov-scramble-laravel-data)
```

###  Alternatives

[dedoc/scramble

Automatic generation of API documentation for Laravel applications.

2.2k12.6M144](/packages/dedoc-scramble)[psalm/plugin-laravel

Psalm plugin for Laravel

3345.4M354](/packages/psalm-plugin-laravel)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

818355.4k3](/packages/defstudio-telegraph)[tarfin-labs/event-machine

Event-driven state machines for Laravel with event sourcing, type-safe context, and full audit trail.

219.6k](/packages/tarfin-labs-event-machine)[elegantly/laravel-translator

All on one translations management for Laravel

6539.5k](/packages/elegantly-laravel-translator)[laravel/surveyor

Static analysis tool for Laravel applications.

89157.7k16](/packages/laravel-surveyor)

PHPackages © 2026

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