canaltp/sam-monitoring-bundle
Laravel bundle for monitoring and diagnostics, providing health/status checks and runtime insights to help detect issues early. Includes endpoints and tooling to track application availability and performance in production environments.
ContainerInterface and EventDispatcher, enabling partial compatibility via adapters.Monolog or third-party monitoring stacks (e.g., spatie/laravel-monitoring).EventDispatcher, HttpFoundation, DependencyInjection → Laravel has equivalents (Illuminate\Events, Illuminate\Http, Illuminate\Container).yaml/xml configs → Laravel’s config/array format (convertible via config/cast or php artisan config:transform).SamMonitoring->recordEvent()), Laravel can proxy these via a Service Provider or Facade.KernelEvents → Laravel’s Events or Middleware (e.g., HandleMonitoringEvents).| Risk Area | Mitigation Strategy |
|---|---|
| Symfony-Specific Code | Abstract Symfony dependencies (e.g., wrap EventDispatcher behind an interface). |
| Database Schema | Use migrations or Eloquent models to adapt Doctrine tables. |
| Configuration Overhead | Provide a Laravel-specific config publisher to auto-generate config/sam.php. |
| Performance Impact | Benchmark event listeners and database writes in Laravel’s context. |
| Maintenance Burden | Fork the repo or contribute upstream to add Laravel support. |
composer.json for symfony/* hard dependencies.)spatie/laravel-monitoring, laravel-debugbar/debugbar).Laravel Compatibility Matrix:
| Symfony Component | Laravel Equivalent | Integration Strategy |
|---|---|---|
EventDispatcher |
Illuminate\Events\Dispatcher |
Direct replacement or adapter. |
HttpFoundation |
Illuminate\Http |
Use Laravel’s request/response objects. |
DependencyInjection |
Illuminate\Container |
Bind services via register() in a provider. |
Doctrine DBAL |
Illuminate\Database |
Raw queries or Eloquent models. |
Console Component |
Illuminate\Console |
Extend Laravel commands. |
Monitoring Stack Synergy:
spatie/laravel-prometheus.Monolog handlers.laravel-notification-channels or pusher.SamMonitoringServiceProvider) to:
config/sam.php).sam:monitoring:check).// app/Models/SamEvent.php
class SamEvent extends Model {
protected $table = 'sam_events';
// ...
}
// EventServiceProvider.php
protected $listen = [
'sam.event.record' => [SamEventListener::class],
];
symfony/http-foundation vs. Laravel’s illuminate/http).symfony/console changes).composer.json or use platform.sh for testing.Container vs. ServiceProvider issues).SamMonitoringLogger::channel()).laravel-queue or database connection pooling.laravel-horizon).| Scenario | Impact | Mitigation |
|---|---|---|
| Bundle update breaks Laravel | Monitoring fails silently. | Use composer why-not to detect conflicts. |
| Database connection issues | Events drop. | Implement retry logic in listeners. |
| Symfony component deprecation | Laravel adapter breaks. | Monitor Symfony’s deprecations. |
| High cardinality metrics | Query performance degrades. | Use time-series databases (e.g., InfluxDB). |
DependencyInjection or EventDispatcher.
app()->make() instead of container->get()").yaml → Laravel’s php may confuse teams.
EventDispatcher → Event::dispatch()).How can I help you explore Laravel packages today?