Scramble 0.12.x is here! Manual parameter docs, transformers API and more.
Learn more

Releases

Keep up with regular Scramble releases.
Latest versions:
Scramble: v0.12.31
Scramble PRO: v0.7.16
August 2025
Aug 24, 2025
v0.7.16 PRO

What’s Changed

  • Fixed paginator links in JSON API resource collection being not marked as optional when a resource didn’t have relationships
Aug 24, 2025
v0.7.15 PRO

What’s Changed

  • Fixed for JSON API identifiers for resource collections relationships
  • Compatibility fixes with Scramble 0.12.31 by @romalytvynenko in #72
Aug 24, 2025
v0.12.31

What’s Changed

  • Improve API resources and resource collections inference and documentation by @romalytvynenko in #937
  • Add ability to configure inference (internal) by @romalytvynenko in #940
Aug 14, 2025
v0.7.14 PRO

What’s Changed

  • Fixed paginated data collections documentation when the type is inferred
  • Correct JSON API response content type (application/vnd.api+json) by @romalytvynenko in #70
Aug 14, 2025
v0.12.30

What’s Changed

  • Add support for transforming inferred paginator types by @romalytvynenko in #931
  • Add support for transforming response type with headers to schema and improve collection responses type to schema transformation by @romalytvynenko in #932
  • Add support for system color theme by @macbookandrew in #923

New Contributors

  • @macbookandrew made their first contribution in #923
Aug 12, 2025
v0.7.13 PRO

Paginated data collections inference

Previously, you had to manually specify the type of data collection returned from a controller method to generate documentation for it:

use Spatie\LaravelData\PaginatedDataCollection;

public function index(Request $request)
{
    return CompanyData::collect(Company::paginate(), PaginatedDataCollection::class);
}

Now, thanks to paginated data collections inference, you can skip that second argument entirely:

public function index(Request $request)
{
    return CompanyData::collect(Company::paginate());
}
Aug 12, 2025
v0.12.29

What’s Changed

  • Fixed Scramble silently logs error when mixed used in a function return type hint by @romalytvynenko in #920
  • Preserve enum cases description when adding description to enum class or properties where enum is used by @romalytvynenko in #926
  • Fixed duplicated schemas in generated spec when using FQN with leading slash in PHPDoc by @romalytvynenko in #929
  • Fixed document serialization issue when response is removed from components by @romalytvynenko in #930
Aug 4, 2025
v0.12.28

What’s Changed

  • Fixed ClassConstFetchTypeGetter breaking when fetching class const on new expression by @romalytvynenko in #918
Aug 3, 2025
v0.7.12 PRO

What’s Changed

  • Use self out type instead of self templates definition extensions
Aug 3, 2025
v0.12.27

Deeper setter analysis

When analyzing method calls, Scramble now infers much more useful type information thanks to deeper setter analysis.

Consider this example:

class Foo
{
    property int $foo;

    public function __construct()
    {
        $this->setFoo(42);
    }

    public function setFoo(int $foo): self
    {
        $this->foo = $foo;
        return $this;
    }
}

Previously, Scramble correctly inferred that new Foo() produces a Foo<42>.

However, if you move the setter call into a setup method, Scramble used to lose that information:

class Foo
{
    property int $foo;

    public function __construct()
    {
        $this->setup();
    }

    private function setup(): void
    {
        $this->setFoo(42);
    }

    public function setFoo(int $foo): self
    {
        $this->foo = $foo;
        return $this;
    }
}

In this case, Scramble would no longer know that $foo had been set to 42.

This release fixes that: the example above now works perfectly as expected. Deep setter analysis applies not only in __construct but in any class method.

This enhancement makes Scramble more accurate across a broader range of codebases, letting you focus on your business logic instead of adding extra annotations.

Performance improvements

Deeper setter analysis requires analyzing more code and doing more work. So initially, the draft version of this feature severely impacted Scramble’s performance (slowing it down by 2x — sic!).

Fixing this performance regression not only resulted in a 10% speed-up over the original performance levels but also slightly reduced memory usage.

Long story short: the performance gain came from skipping work that wasn’t absolutely necessary. So, going back to the latest example: if setup or setFoo methods are never called in places Scramble actually cares about (like API controllers), they won’t be analyzed — which significantly boosts performance.

Also, if you have a statement like return count(some_complex_function()), some_complex_function() won’t be analyzed at all, since count is known to return an int regardless of the arguments you pass.

This required some internal changes to how arguments are handled, which might technically be breaking changes — but they shouldn’t affect you, since it’s all internal.

🚨 Potentially breaking changes

This release does not introduce any changes to the public API documented in the docs. However, if you rely on undocumented internals to extend type inference, please note:

  • All call event classes’ arguments property is now an instance of Dedoc\Scramble\Infer\Contracts\ArgumentTypeBag, instead of plain array<string, Type>. This affects Dedoc\Scramble\Infer\Extensions\Event\{AnyMethodCallEvent, FunctionCallEvent, MethodCallEvent, SideEffectCallEvent, StaticMethodCallEvent} classes.
  • The early “side effects” concept has been replaced by industry-adopted self-out types (does anyone understand this sentence at all?). As a result, the following classes have been removed: Dedoc\Scramble\Support\Type\SideEffects\{SelfTemplateDefinition, ParentConstructCall}.

What’s Changed

  • Added 'present' validation rule support by @chrisvanlier2005 in #915
July 2025
Jul 27, 2025
v0.12.26

What’s Changed

  • Change extensions order to handle custom inference extensions before default inference extensions by @chrisvanlier2005 in #831
  • Reference type resolver cleanup by @romalytvynenko in #909
Jul 26, 2025
v0.12.25

What’s Changed

  • Validation rules documentation is retrieved from inferred type rather than from AST nodes by @romalytvynenko in #906
  • Fixed performance regression and too much memory usage by @romalytvynenko in #907
Jul 25, 2025
v0.7.11 PRO

What’s Changed

  • Fixed redefining types on query builder filters
Jul 25, 2025
v0.12.24

What’s Changed

  • Add support for adding custom headers to responses by @romalytvynenko in #884
  • Fixed issue when analyzing properties of internal classes by @romalytvynenko in #886
  • Fixed empty api_path config was not matching any routes by @romalytvynenko in #889
  • Improved documentation of complex query parameters (arrays, objects) by @romalytvynenko in #890
  • Added response attribute by @romalytvynenko in #894
  • Added between validation rule support by @romalytvynenko in #895
  • Simplified header attribute behavior by @romalytvynenko in #896
  • Fixed response type parsing with correct PHPDoc file name context by @romalytvynenko in #898
  • Preparation for the next release by @romalytvynenko in #899
  • Added support for binary and streamed responses automatic documentation by @romalytvynenko in #901
  • Cleaned up reference resolver (moved away vendor analysis responsibility) by @romalytvynenko in #903
Jul 9, 2025
v0.7.10 PRO

What’s Changed

  • Fixed issue when Scramble couldn’t document Laravel Data properties that were using RouteParameterReference external reference due to the rules being evaluated not in the expected route’s/request’s context
June 2025
Jun 17, 2025
v0.12.23

What’s Changed

  • Fixed document level tags ordering when using weight argument on #[Group] attribute by @romalytvynenko in #870
  • Fix setOperationId called in an operation transformer not working by @romalytvynenko in #872
Jun 3, 2025
v0.12.22

What’s Changed

  • Fixed incorrect generic creation when looking for JSON resource in anonymous resource collection by @romalytvynenko in #862
  • Fixed memory leak when running tests if there are extensions registered via programmatic API by @romalytvynenko in #864
  • Allow using #[Group] attribute on route’s controller methods by @romalytvynenko in #865
May 2025
May 28, 2025
v0.7.9 PRO

What’s Changed

  • Added $attributes and $relationships properties support for timacdonald/json-api
  • Add json-api toLinks support by @romalytvynenko in #56
  • Added spatie/laravel-json-api-paginate support by @romalytvynenko in #57
  • json-api improvements by @romalytvynenko in #58
  • Bump dependabot/fetch-metadata from 2.2.0 to 2.4.0 by @dependabot in #59
  • PHPstan with baseline by @romalytvynenko in #60
April 2025
Apr 4, 2025
v0.7.8 PRO

Documenting query builders defined in called methods

Let’s say you have the following controller that retrieves a list of hotels and returns this list in a response:

class HotelsController
{
    public function __construct(public HotelsListService $hotelsListService) {}
    
    public function index()
    {
        $hotels = $this->hotelsListService->list($request->int('per_page', 15));
        
        return HotelResource::collection()
    }
}

And the following HotelsListService implementation:

class HotelsListService
{
    public function list(int $perPage): QueryBuilder
    {
        return QueryBuilder::for(Hotel::class)
            ->allowedFilters([
                'rooms',
                'name',
                'price',
            ])
            ->allowedSorts([
                'price',
                'rooms',
            ]);
    }
}

Prior to this version Scramble documented only query builders that were constructed in the controller method’s body. But now Scramble analyzes all method calls in the controller’s method so now it can document such cases!

What’s Changed

  • Looking for query builder definitions in the called methods
March 2025
Mar 18, 2025
v0.7.7 PRO

What’s Changed

  • Added toJson, toArray, and toResponse methods support on data objects
Scramble PRO
Comprehensive API documentation generation for Spatie’s Laravel Data, Laravel Query Builder, and other packages.