tylercd100/monolog-sms
Laravel/Lumen package that adds an SMS handler to Monolog, letting you send log alerts and critical errors via text message using popular SMS gateways. Useful for on-call notifications when something breaks in production.
Log::channel()).Single, Stream, Slack) without disrupting core logging.Log facade.config/logging.php or dynamically via code.monolog/monolog (v2.x) and a third-party SMS provider (e.g., Twilio, AWS SNS). Version conflicts could arise if the project uses an older Monolog version.level thresholds, bubble behavior). May require custom formatting for SMS constraints (e.g., 160 chars).write() method (advanced).| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| SMS Provider Downtime | High | Fallback to email/Slack; implement retries. |
| Rate Limiting | Medium | Configure maxSMSPerMinute or use level. |
| Character Truncation | Medium | Customize formatter to split long logs. |
| Monolog Version Mismatch | Low | Pin monolog/monolog to v2.x in composer.json. |
| Cost Overruns | High | Set strict log levels (e.g., ERROR only). |
errorHandler)?Log facade and config/logging.php.Stack handler for multi-channel logging).twilio/sdk). May require additional packages for non-Twilio providers.single, stack) to identify SMS-worthy events.composer require twilio/sdk).config/logging.php:
'sms' => [
'driver' => 'monolog',
'handler' => TylerCD100\MonologSms\SmsHandler::class,
'sms_provider' => 'twilio',
'twilio_sid' => env('TWILIO_SID'),
'twilio_token' => env('TWILIO_TOKEN'),
'from' => '+1234567890',
'level' => 'ERROR',
'bubble' => false, // Prevents SMS for lower-priority logs
],
AppServiceProvider@boot() if needed.$handler = new SmsHandler($provider, $level);
$handler->setFormatter($formatter);
$handler->pushProcessor($processor);
.env (never in code).SmsHandler exceptions).monolog/monolog:^2.0 to avoid breaking changes.DEBUG for a single route).ERROR/CRITICAL logs with fallback to email.level to ERROR or higher to avoid high-volume costs.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| SMS Provider Outage | Critical alerts missed | Fallback to email/Slack. |
| Rate Limiting Exceeded | Logs dropped | Implement exponential backoff. |
| Credential Leak | Unauthorized SMS sends | Rotate keys; use Laravel Envoyer. |
| Malformed Log Messages | SMS delivery failures | Validate/format logs before sending. |
| High Log Volume | Cost overruns | Set strict log levels. |
Log::channel('sms')->error()").config/logging.php for AWS SNS.How can I help you explore Laravel packages today?