Overview
The Laravel OpenAPI Generator does not currently define custom event classes or listeners. The package focuses on direct generation without event-based workflows.While the package doesn’t dispatch Laravel events, it does provide logging hooks and cache integration points for observability.
Current State
The service provider includes a placeholder method for future event integration: Location:src/Providers/OpenApiGeneratorServiceProvider.php
Logging as Event Alternative
The package uses Laravel’s logging system extensively, which can serve as an observability mechanism.Logging Channel
All generation activities are logged to theopenapi channel:
Logged Activities
The generator logs various activities that could be considered “events”: Route Processing:src/Services/OpenApiServices.php (multiple occurrences)
Monitoring Generation
You can monitor generation by tailing the log file:Cache Hooks
While not events, the cache system provides integration points:Cache Store
When a specification is generated and cached: Location:src/Services/OpenApiServices.php:110-112
Cache Retrieval
When a cached specification is retrieved: Location:src/Services/OpenApiServices.php:90-95
Cache Clearing
When cache is manually cleared: Location:src/Services/OpenApiServices.php:1479-1488
Future Event System
If you need event-based workflows, you can implement them in your application.Custom Event Example
Define an Event:Potential Event Points
If the package were to implement events, these would be logical dispatch points:Before Generation
- Validate configuration
- Log generation request
- Clear stale cache
After Generation
- Store spec to database
- Upload to CDN or S3
- Send notifications
- Update documentation site
Cache Events
- Monitor cache performance
- Trigger cache warming
- Alert on cache misses
Route Discovery
- Log discovered routes
- Track API growth
- Detect new endpoints
Export Events
- Auto-import to collection management
- Sync with team workspace
- Trigger CI/CD pipelines
Laravel Event Integration
You can hook into Laravel’s existing events:Model Events
If you store specs in a database:Cache Events
Listen to Laravel’s cache events:Observability Patterns
Telescope Integration
If using Laravel Telescope, generation activities are automatically recorded:- Cache hits/misses
- Log entries
- HTTP requests (if using routes)
- Command execution (Artisan)
Custom Metrics
Track generation metrics:Webhook Integration
Trigger webhooks after generation:Scheduled Generation
Use Laravel’s scheduler as a time-based “event” system:Related Documentation
Public API
Programmatic generation API
Configuration
Configure logging and cache
Logging
Advanced logging configuration
Testing
Test generation workflows