victormgomes / scramble-extensions
Useful extensions for the dedoc/scramble package
Package info
github.com/VictorMGomes/scramble-extensions
pkg:composer/victormgomes/scramble-extensions
Fund package maintenance!
Requires
- php: ^8.4
- dedoc/scramble: ^0.13
- illuminate/contracts: ^11.0||^12.0||^13.0
- illuminate/support: ^11.0||^12.0||^13.0
- nikic/php-parser: ^5.0
- spatie/laravel-data: ^4.0||^5.0
- spatie/laravel-package-tools: ^1.16
- webmozart/assert: ^1.11
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.8
- orchestra/testbench: ^10.0.0||^9.0.0
- pestphp/pest: ^4.0
- pestphp/pest-plugin-arch: ^4.0
- pestphp/pest-plugin-laravel: ^4.0
- phpstan/extension-installer: ^1.4
- phpstan/phpstan-deprecation-rules: ^2.0
- phpstan/phpstan-phpunit: ^2.0
- spatie/laravel-ray: ^1.35
README
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-dataobjects.
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.