app-watch-laravel-client maintained by baklysystems
Description
Self-hosted Laravel monitoring — client package for automatic telemetry collection (exceptions, logs, queries, queues, schedules, HTTP requests, metrics, MySQL health)
Author
Last update
2026/06/05 17:31
(dev-main)
License
Downloads
0
Tags
App Watch — Laravel Client
A lightweight, zero-config Composer package that automatically collects telemetry from any Laravel application and sends it to your self-hosted Appswatch monitoring server.
What It Captures
| Surface | Method | Details |
|---|---|---|
| Exceptions | Event listener | Captures all unhandled + logged exceptions with stack traces, breadcrumbs, severity mapping |
| Logs | Monolog handler | Batches log entries (level, context, channel, trace ID) |
| Database Queries | DB::listen() |
SQL, bindings, duration, slow query detection |
| Queue Jobs | Job events | Processing/completed/failed with attempt tracking and timing |
| Scheduled Tasks | Schedule events | Start/completed/failed with output capture and duration |
| HTTP Requests | Middleware | Method, URL, status code, duration, memory, request body (masked) |
| Custom Metrics | Static collector | Gauge, counter, histogram via MetricCollector |
| MySQL Health | SHOW STATUS |
Connections, buffer pool, QPS, replication lag, key cache |
Installation
composer require baklysystems/app-watch-laravel-client
Laravel auto-discovery registers the service provider and facade automatically. No manual configuration needed.
Configuration
Publish the config file:
php artisan vendor:publish --tag=appswatch-config
Set these environment variables in your .env:
APPSWATCH_SERVER_URL=https://your-appswatch-instance.com
APPSWATCH_API_KEY=your-project-api-key
APPSWATCH_ENABLED=true
APPSWATCH_ENVIRONMENT=production
APPSWATCH_RELEASE=v1.2.3
Usage
Automatic: Everything is captured automatically once the package is installed and configured.
Manual / programmatic (uses the Facade):
use Appswatch;
// Log a custom event
Appswatch::log('info', 'User signed up', ['user_id' => 42]);
// Capture an exception manually
try {
riskyOperation();
} catch (\Throwable $e) {
Appswatch::exception($e, ['user_id' => $userId]);
}
// Send a custom metric
Appswatch::metric('users.signed_up', 1, 'count', ['plan' => 'pro']);
Custom Job Middleware
Wrap any queued job to capture timing and failures:
use BaklySystems\AppWatch\Middleware\AppswatchJobMiddleware;
class MyJob implements ShouldQueue
{
public function middleware(): array
{
return [new AppswatchJobMiddleware];
}
}
Custom Metrics from Your Code
use BaklySystems\AppWatch\Collectors\MetricCollector;
MetricCollector::counter('orders.placed', 1, 'count', ['channel' => 'web']);
MetricCollector::gauge('users.active', 150, 'count', ['plan' => 'pro']);
MetricCollector::histogram('api.response_time_ms', 42.5, 'ms', ['endpoint' => '/api/users']);
Architecture
Your Laravel App
│
▼
┌─────────────────────────────────────────────┐
│ Appswatch Package (this) │
│ │
│ ExceptionCollector ───┐ │
│ LogCollector ──────────┤ │
│ QueryCollector ────────┤ ┌────────────┐ │
│ QueueCollector ────────┼───▶│HttpTransport│─┼──▶ Your Appswatch Server
│ ScheduleCollector ─────┤ └────────────┘ │ /api/ingest/*
│ RequestMiddleware ─────┤ │ │
│ MetricCollector ───────┘ (buffered) │
│ MySqlHealthCollector retry on fail │
└─────────────────────────────────────────────┘
Requirements
- PHP 8.2+
- Laravel 11.x or 12.x
- Guzzle 7
- Monolog 3
License
MIT. See LICENSE.