victormgomes / async-api
Automatically generate documentation for the AsyncAPI specification based on Laravel events
Fund package maintenance!
Requires
- php: ^8.3
- illuminate/console: ^12.0 || ^13.0
- illuminate/contracts: ^12.0 || ^13.0
- illuminate/filesystem: ^12.0 || ^13.0
- illuminate/routing: ^12.0 || ^13.0
- illuminate/support: ^12.0 || ^13.0
- illuminate/view: ^12.0 || ^13.0
- laravel/ranger: ^0.2.5
- laravel/surveyor: ^0.2.6
- spatie/laravel-data: ^4.0
- spatie/laravel-package-tools: ^1.16
- symfony/finder: ^7.0 || ^8.0
Requires (Dev)
- captainhook/captainhook: ^5.0
- captainhook/plugin-composer: ^5.0
- infection/infection: ^0.33
- larastan/larastan: ^3.0
- laravel/pao: ^1.1
- laravel/pint: ^1.14
- maglnet/composer-require-checker: ^4.0
- nunomaduro/collision: ^8.8
- nunomaduro/phpinsights: ^2.11
- orchestra/testbench: ^10.0 || ^11.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
- rector/rector: ^1.0|^2.0
README
Automatically generates AsyncAPI 3.0 documentation from your Laravel broadcasting implementations.
Package Status
Why Use It?
In modern event-driven architectures, documenting broadcast events is as
crucial as documenting REST APIs. laravel-async-api bridges this gap for
Laravel applications by automating the generation of AsyncAPI specifications.
It empowers you to document your broadcast events and generates fully compliant AsyncAPI 3.0 specifications with zero manual effort.
Features
- Zero-Effort Documentation: Stop maintaining manual AsyncAPI files. Your events are documented automatically.
- Schema Integration: The broadcasting implementation structure, including data types, is inferred automatically to ensure your documentation always matches your code.
- Seamless Integration: Works perfectly with Laravel's broadcasting system (Reverb, Pusher, Soketi).
- AsyncAPI 3.0 Compliant: Generates specifications that follow the latest AsyncAPI standard.
- AI Agent Ready: Includes an official Laravel Boost skill to automatically teach AI agents (like Claude Code and Cursor) how to use this package in your project.
How It Works
The package automatically discovers any event class in your application that implements ShouldBroadcast.
class ChatMessage implements ShouldBroadcast { // ... }
By simply implementing ShouldBroadcast, your event is instantly documented. The package uses static code analysis to automatically infer the payload schema directly from your properties, arrays, generics, and PHPDocs without requiring any manual reflection or hints!
🚀 Quick Start
Step 1: Installation
Install the package via Composer:
composer require victormgomes/async-api
Step 2: Publish the Configuration (Optional)
If you need to customize the default settings (like server host, port, or title), publish the config file:
php artisan vendor:publish --tag="async-api-config"
Step 3: Access the Documentation
Visit http://localhost/docs/broadcast in your application to view the interactive AsyncAPI
documentation. The raw JSON specification is also available at http://localhost/docs/broadcast/json.
Documentation
For a deep dive into the features, please read the Official Documentation.
Credits
Support Us
If you find this package useful in your day-to-day development, please consider sponsoring my work or leaving a ⭐ on the repository. Your support directly helps keep this project actively maintained and free!
Community & Guidelines
License
The MIT License (MIT). Please see License File for more information.