Skip to content

VictorMGomes/scramble-extensions

Repository files navigation

Scramble Extensions

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads License

Useful extensions for the dedoc/scramble package


Introduction

Scramble Extensions provides a collection of powerful tools to supercharge your dedoc/scramble documentation. It automates common API documentation tasks like adding security headers, handling multi-tenancy, and providing deep integration for Spatie's Laravel Data DTOs.

Why use this package?

  • Automation: Automatically add Authorization and Tenant headers to your OpenAPI specification.
  • Rich DTO Support: Seamlessly generate schemas for complex DTOs built with spatie/laravel-data.
  • Clean Documentation: Keep your controller annotations minimal by letting these extensions handle the global requirements of your API.
  • Better DX: Provide a much more accurate and interactive "Try It" experience in your documentation UI.

Support us

We invest a lot of resources into creating best in class open source packages. You can support us by sponsoring us on GitHub.


Installation

composer require victormgomes/scramble-extensions

Usage

Register the desired extensions in your config/scramble.php file:

//config/scramble.php
return [
    // ...
    'extensions' => [
        \Victormgomes\ScrambleExtensions\Extensions\AddAuthorizationHeader::class,
        \Victormgomes\ScrambleExtensions\Extensions\AddTenantHeader::class,
        \Victormgomes\ScrambleExtensions\Extensions\SpatieData::class,
    ],
];

Included Extensions

  • AddAuthorizationHeader: Automatically adds the Bearer token field to authenticated routes.
  • AddTenantHeader: Injects the required Tenant-ID header for multi-tenant routes.
  • SpatieData: Generates accurate OpenAPI schemas from spatie/laravel-data objects.

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.

About

Useful magic extensions for dedoc/scramble package

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages