Download the PHP package drmmr763/laravel-asyncapi without Composer
On this page you can find all versions of the php package drmmr763/laravel-asyncapi. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download drmmr763/laravel-asyncapi
More information about drmmr763/laravel-asyncapi
Files in drmmr763/laravel-asyncapi
Package laravel-asyncapi
Short Description Laravel package for AsyncAPI 3.0.0 specification with annotations and code generation
License MIT
Homepage https://github.com/drmmr763/laravel-asyncapi
Informations about the package laravel-asyncapi
Laravel package for AsyncAPI 3.0.0 specification with annotations and code generation
A Laravel package that integrates php-asyncapi-annotations to provide AsyncAPI 3.0.0 specification generation using PHP 8.3+ attributes. This package allows you to define your AsyncAPI specifications directly in your Laravel code using attributes and generate specification files in JSON or YAML format.
Installation
You can install the package via composer:
You can publish the config file with:
This is the contents of the published config file:
Usage
Define AsyncAPI Specifications with Attributes
Use PHP 8.3+ attributes to define your AsyncAPI specifications directly in your code:
Available Commands
The package provides several Artisan commands:
Generate Specification
Generate and display the AsyncAPI specification:
Generate with specific format:
Generate and save to file:
Export Specification
Export the specification to a file:
Validate Specification
Validate your AsyncAPI annotations:
List Annotations
List all AsyncAPI annotations found in your codebase:
Filter by annotation type:
Using the Facade
You can also use the AsyncApi facade in your code:
Using Dependency Injection
You can also inject the AsyncApi class directly:
Examples
The package includes several comprehensive examples in the examples/ directory:
1. Laravel Broadcast Events
See examples/LaravelBroadcastExample.php for examples of annotating Laravel broadcast events:
This example includes:
- Public channel broadcasts
- Private channel broadcasts
- Presence channel broadcasts
- Typing indicators and real-time features
2. Reusable Components with References
See examples/ReusableComponentsExample.php for a complete example of using refs:
Benefits of using refs:
- DRY Principle: Define schemas once, reference everywhere
- Consistency: Ensures the same schema is used across all messages
- Maintainability: Update schema in one place, changes reflect everywhere
- Composition: Build complex schemas from simpler reusable components
3. Complete E-Commerce Example
See examples/ExampleAsyncApiSpec.php for a full specification including:
- Multiple channels (Kafka, WebSocket)
- Server configurations
- Operations (send/receive)
- Security schemes
- Complete component definitions
4. Laravel Controller Integration
See examples/LaravelControllerExample.php for practical examples of:
- Serving AsyncAPI specs via HTTP endpoints
- Triggering broadcast events documented in AsyncAPI
- Rendering AsyncAPI documentation in your app
- Caching generated specifications
- Creating custom Artisan commands
Example routes:
Advanced Usage
Organizing Large Specifications
For large applications, organize your AsyncAPI definitions across multiple files:
Custom Scan Paths
Configure which directories to scan for AsyncAPI annotations:
Caching for Performance
Enable caching to improve performance in production:
Clear the cache when you update your annotations:
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Chad Windnagle
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-asyncapi with dependencies
spatie/laravel-package-tools Version ^1.16
illuminate/contracts Version ^11.0||^12.0||^13.0
drmmr763/php-asyncapi-annotations Version ^1.0
symfony/yaml Version ^6.0|^7.0|^8.0