picobaz / laravel-sentinel
Advanced monitoring and alerting system for Laravel applications with real-time notifications
Installs: 2
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/picobaz/laravel-sentinel
Requires
- php: ^8.1
- illuminate/console: ^10.0|^11.0|^12.0
- illuminate/database: ^10.0|^11.0|^12.0
- illuminate/support: ^10.0|^11.0|^12.0
Requires (Dev)
- orchestra/testbench: ^8.0|^9.0
- phpunit/phpunit: ^10.0
README
Advanced monitoring and alerting system for Laravel applications with real-time notifications across multiple channels.
✨ Features
- 🔍 Query Monitoring - Detect and log slow database queries
- 💾 Memory Monitoring - Track memory usage and prevent leaks
- 🚨 Exception Monitoring - Catch and categorize exceptions
- ⚡ Performance Monitoring - Monitor response times
- 📊 Beautiful Dashboard - Real-time metrics visualization
- 🔔 Multi-Channel Alerts - Slack, Telegram, Discord, Email
- 🧩 Modular Architecture - Easily extend with custom modules
- ⚙️ Smart Thresholds - Configurable alert triggers
- 📈 Analytics - Detailed performance insights
📦 Installation
composer require picobaz/laravel-sentinel
Publish Configuration
php artisan sentinel:install
This will:
- Publish configuration file to
config/sentinel.php - Publish views to
resources/views/vendor/sentinel - Run migrations
⚙️ Configuration
Edit config/sentinel.php:
return [ 'enabled' => true, 'modules' => [ 'queryMonitor' => true, 'memoryMonitor' => true, 'exceptionMonitor' => true, 'performanceMonitor' => true, ], 'thresholds' => [ 'query_time' => 1000, 'memory_usage' => 128, 'response_time' => 2000, ], 'notifications' => [ 'channels' => [ 'telegram' => true, 'slack' => false, 'email' => true, 'discord' => false, ], ], ];
Environment Variables
SENTINEL_ENABLED=true SENTINEL_QUERY_TIME_THRESHOLD=1000 SENTINEL_MEMORY_THRESHOLD=128 SENTINEL_RESPONSE_TIME_THRESHOLD=2000 SENTINEL_TELEGRAM_ENABLED=true SENTINEL_TELEGRAM_BOT_TOKEN=your_bot_token SENTINEL_TELEGRAM_CHAT_ID=your_chat_id SENTINEL_SLACK_ENABLED=false SENTINEL_SLACK_WEBHOOK=your_webhook_url SENTINEL_EMAIL_ENABLED=true SENTINEL_EMAIL_RECIPIENTS=admin@example.com,dev@example.com
🚀 Usage
Automatic Monitoring
Sentinel automatically monitors your application once installed. All modules run in the background.
Manual Logging
use PicoBaz\Sentinel\Facades\Sentinel; Sentinel::log('custom', [ 'action' => 'user_login', 'user_id' => 123, 'ip' => request()->ip(), ]);
Middleware
Add to specific routes:
Route::middleware(['sentinel'])->group(function () { Route::get('/dashboard', [DashboardController::class, 'index']); });
Dashboard
Access the dashboard at: http://your-app.test/sentinel
Artisan Commands
php artisan sentinel:status
🧩 Creating Custom Modules
namespace App\Sentinel\Modules; class CustomModule { public function boot() { // Your monitoring logic } }
Register in config/sentinel.php:
'modules' => [ 'customModule' => true, ],
📱 Notification Channels
Telegram
- Create a bot via @BotFather
- Get your chat ID from @userinfobot
- Configure in
.env
Slack
- Create incoming webhook in Slack
- Add webhook URL to
.env
Discord
- Create webhook in Discord server settings
- Add webhook URL to
.env
📊 Metrics API
GET /sentinel/metrics/{type}?hours=24
Types: query, memory, exception, performance
Response:
[
{
"id": 1,
"type": "query",
"data": {...},
"severity": "warning",
"created_at": "2024-01-01 12:00:00"
}
]
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
📝 License
This package is open-sourced software licensed under the MIT license.
👤 Author
PicoBaz
- Email: picobaz3@gmail.com
- GitHub: @PicoBaz
- Telegram: @picobaz
🌟 Support
If you find this package helpful, please consider giving it a ⭐ on GitHub!
📚 Documentation
For detailed documentation, visit https://github.com/PicoBaz/laravel-sentinel/wiki
🐛 Issues
Report issues at https://github.com/PicoBaz/laravel-sentinel/issues