Download the PHP package hamzi/corewatch without Composer
On this page you can find all versions of the php package hamzi/corewatch. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download hamzi/corewatch
More information about hamzi/corewatch
Files in hamzi/corewatch
Package corewatch
Short Description Production-ready embedded DevOps dashboard for Laravel โ server metrics, log streaming, safe ops panel, and alerting without external daemons.
License MIT
Homepage https://github.com/hamdyelbatal122/CoreWatch
Informations about the package corewatch
Laravel CoreWatch ๐ก๏ธ
Embedded DevOps dashboard for Laravel โ monitor, debug, and operate your server without leaving your app
Quick Start ยท Why CoreWatch? ยท Developer API ยท Architecture ยท Filament ยท Troubleshooting
[!IMPORTANT] CoreWatch is a self-contained server monitoring utility for Laravel applications. It provides real-time system metrics, log streaming, and operational controls without requiring external agents or daemons like Netdata or Grafana.
Why CoreWatch?
| Problem | CoreWatch Solution |
|---|---|
| "I need server metrics without external daemons" | Reads /proc directly โ zero background processes |
| "Log files are multi-gigabyte and crash web viewers" | O(1) memory backward-seeking parser streams any file size |
| "I want safe administrative actions without shell risks" | Whitelisted command keys only โ no raw shell input accepted |
| "I use Filament or Livewire and need embedded monitoring" | Livewire component and modular Blade partials |
| "I need alerts when CPU or RAM spikes" | Scheduled health check with Slack, Telegram, and custom events |
| "Load balancer needs a health check endpoint" | GET /corewatch/api/health returns 200 or 503 |
CoreWatch vs. Alternatives
| Feature | CoreWatch | Netdata | Laravel Telescope | Grafana Agent |
|---|---|---|---|---|
| Zero external daemon | โ | โ | โ | โ |
| Server metrics (CPU/RAM/Disk) | โ | โ | โ | โ |
| Log file streaming | โ | โ | โ | โ |
| Safe ops panel | โ | โ | โ | โ |
| Laravel-native install | โ | โ | โ | โ |
| Filament/Livewire embed | โ | โ | โ | โ |
| Built-in alerting | โ | โ | โ | โ |
โก Quick Start (30 seconds)
Open /corewatch in your browser. That's it.
For production, add auth middleware in config/corewatch.php and schedule health checks:
System Architecture
The following diagram illustrates how CoreWatch handles data collection, log streaming, and alert dispatching:
๐๏ธ Package Architecture (Clean Architecture)
CoreWatch follows layered architecture with clear separation of concerns:
| Layer | Responsibility | Example |
|---|---|---|
| Contracts | Define abstractions | SystemMetricsCollectorInterface |
| Domain | Pure business logic | HealthThresholdEvaluator |
| Application | Orchestrate use cases | GetServerMetricsAction |
| Infrastructure | External I/O | LogFileRepository, CpuMetricsCollector |
| Http | HTTP boundary | DashboardController (thin) |
๐งฑ Modular @include Partial Architecture
CoreWatch separates all diagnostics into elegant, self-contained monospace tables inside resources/views/partials/. This modular structure allows clients to easily publish views and include specific tables anywhere inside their custom dashboards:
| Partial Blade View Path | Diagnostic Target | Layout Display Style | Customization Purpose |
|---|---|---|---|
partials.cpu |
CPU Cores & Load averages | Monospace Table | Monitor core load thresholds (1m, 5m, 15m) |
partials.ram |
System Memory (RAM) Allocation | Monospace Table | Track allocated, free, and available memory |
partials.disk |
Disk Storage & Volumes | Space Usage Table | Monitor root storage partition size limits |
partials.processes |
Top Linux processes | Process Table | Identify high CPU & memory processes |
partials.database |
Database engine & size | DB Status Table | Track table counts and database size |
partials.app-checks |
Application health checks | Status Indicator List | Verify Cache, Queue, and Security modes |
partials.specifications |
Host specifications | Specs Table | Display PHP, OS, and server version info |
partials.services |
Whitelisted service controls | Action Table | Safe execution of authorized commands |
partials.logs |
Live log stream | Log Console | View and filter real-time logs with pagination |
Key Highlights
- Light & Dark Theme UI: Self-contained Blade views with built-in Light and Dark themes. Built with Tailwind CSS and Alpine.js with zero bundler dependencies.
- Memory-Safe Log Streaming: Streams Laravel, Nginx, and Apache log files using backward chunked seeks ($O(1)$ memory usage) even on multi-gigabyte log files.
- Low-Overhead System Metrics: Reads
/procdirectly with shell command fallbacks to report CPU load, RAM allocation, disk capacity, and uptime. - Whitelisted Service Controls: Safe execution of pre-configured administrative commands (queue restart, cache clearing) mapped to strict keys to prevent arbitrary command execution.
- Top Active Processes: Displays active Linux processes sorted by CPU and memory usage with PID and owner.
- Database Telemetry: Shows connection status, table count, and estimated database size for MySQL, PostgreSQL, and SQLite.
- Application Integrity Checks: Verifies cache store, queue driver, environment, and debug mode status.
- Livewire & Filament Support: Includes a Livewire component (
<livewire:corewatch-dashboard />) for embedding into Filament and custom admin panels. - Scheduled Health Alerts: Background command (
corewatch:check-health) that evaluates resource limits and dispatches alerts to Slack, Telegram, or custom event listeners. - Developer Facade API: Access metrics programmatically via the
CoreWatchfacade (CoreWatch::metrics(),CoreWatch::health()). - One-Command Install:
php artisan corewatch:installpublishes configuration and displays a production checklist. - Health Probe Endpoint: Built-in JSON health endpoint for load balancers (
/corewatch/api/health) and Prometheus metric exporter (/corewatch/api/metrics/prometheus).
๐ ๏ธ Installation & Setup
Production Install (Packagist)
Publish Views (Optional โ for customization)
Local Development (Path Repository)
Integration Options
CoreWatch supports multiple integration methods:
[!TIP] When including modular partials in a custom page, wrap them in the parent Alpine.js controller:
<div x-data="corewatchDashboard()">...</div>.
Option A: Standalone Route
Navigate directly to /corewatch to access the full dashboard.
Option B: Modular Partials
Publish the views and embed specific partials inside existing administrative pages:
Option C: Blade Component
Embed the dashboard view directly:
Option D: Livewire Component
Embed the Livewire component in Filament dashboards or custom panels:
โ๏ธ Thresholds & Alerting
Enable real-time warnings on Slack or Telegram by configuring your host .env:
Register heartbeat and health checks in routes/console.php:
Diagnostic & Operational Commands
Verify your deployment and alert pipelines via Artisan:
๐จโ๐ป Developer API (Programmatic Access)
CoreWatch exposes a Facade and Manager for use in your own code, jobs, and custom admin panels:
Health Endpoint (Uptime Monitors / K8s Probes)
Returns 200 when healthy, 503 when thresholds are breached. Configure in .env:
Prometheus (Grafana / Monitoring)
Arabic Localization
Publish translations: php artisan vendor:publish --tag=corewatch-lang
Custom Alert Channels (Events)
Hook into threshold breaches in your AppServiceProvider:
| Guide | Description |
|---|---|
| Architecture | Layer diagram, data flow, and extension guide |
| Filament Integration | Embed in Filament admin panels |
| Troubleshooting | Common issues and fixes |
| Deployment | Production checklist |
| Contributing | Development workflow and coding standards |
| Security | Vulnerability reporting policy |
๐ Security Practices & Fallbacks
- RCE Protection: CoreWatch never accepts raw input strings to execute shell commands. It maps requests to rigid keys registered in
config/corewatch.phpand blocks any unauthorized requests. - Memory Safety: The Log Parser uses direct
fseekbackward seeking to stream logs in 64KB blocks, maintaining a strict $O(1)$ memory consumption profile regardless of log file size. - Graceful Fallbacks: If commands like
execorproc_openare disabled inphp.ini, the package falls back to parsing native/procdirect files and displays interactive notifications.
๐ License
The MIT License (MIT). Please see License File for more information.