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

v1.0.1 2025-11-23 13:16 UTC

This package is auto-updated.

Last update: 2025-11-23 13:21:00 UTC


README

Advanced monitoring and alerting system for Laravel applications with real-time notifications across multiple channels.

License PHP Laravel

✨ 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

  1. Create a bot via @BotFather
  2. Get your chat ID from @userinfobot
  3. Configure in .env

Slack

  1. Create incoming webhook in Slack
  2. Add webhook URL to .env

Discord

  1. Create webhook in Discord server settings
  2. 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

🌟 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