ogeagleeye / monitor-php
OGEagleEye monitoring SDK for PHP 7.4+
Requires
- php: >=7.4
- ext-curl: *
- ext-json: *
Requires (Dev)
Suggests
- monolog/monolog: Push OGEagleEye\Monitor\Logging\OGEagleEyeHandler to capture application logs as event_type=log
This package is not auto-updated.
Last update: 2026-08-06 13:58:39 UTC
README
PHP SDK for OGEagleEye. Ask your system admin for:
- Ingest key (
oge_…) - Events endpoint (e.g.
https://your-host/api/v1/events)
Requirements
- PHP 7.4+
ext-curl,ext-json
Install
Prefer the 1.x line (1.0.1+) so Composer resolves log capture:
composer require ogeagleeye/monitor-php:^1.0
Setup
- Get the ingest key and endpoint from your system admin.
- Initialize early in your app bootstrap (before other code runs):
<?php use OGEagleEye\Monitor\OGEagleEye; require __DIR__ . '/vendor/autoload.php'; OGEagleEye::init([ 'key' => 'oge_YOUR_KEY_FROM_ADMIN', 'endpoint' => 'https://your-host/api/v1/events', 'environment' => 'production', // optional ]);
Or via environment variables:
OGEAGLEEYE_KEY=oge_YOUR_KEY_FROM_ADMIN OGEAGLEEYE_ENDPOINT=https://your-host/api/v1/events
OGEagleEye::init([ 'key' => getenv('OGEAGLEEYE_KEY'), 'endpoint' => getenv('OGEAGLEEYE_ENDPOINT'), ]);
That is enough. Exceptions and fatals are reported automatically after init().
Application logs (Monolog)
To also ship application logs as event_type=log, push the Monolog handler after init() (requires monolog/monolog):
use Monolog\Logger; use OGEagleEye\Monitor\Logging\OGEagleEyeHandler; use OGEagleEye\Monitor\OGEagleEye; OGEagleEye::init([ 'key' => getenv('OGEAGLEEYE_KEY'), 'endpoint' => getenv('OGEAGLEEYE_ENDPOINT'), 'capture_logs' => true, // default true 'log_level' => 'info', // debug|info|notice|warning|error|critical|alert|emergency ]); $logger = new Logger('app'); $logger->pushHandler(OGEagleEyeHandler::fromClient()); $logger->info('order placed', ['order_id' => 42]); $logger->error('payment failed');
Manual messages (any level; bypasses the automatic log_level filter):
OGEagleEye::captureMessage('hello', 'info', ['order_id' => 42]);
Heartbeat
Heartbeats are opt-in. Error reporting does not send them. Until this app sends heartbeats, the OGEagleEye panel shows Heartbeat: none.
use OGEagleEye\Monitor\OGEagleEye; OGEagleEye::heartbeat(); OGEagleEye::flush();
Schedule that on this host (for example every minute via cron) so the platform can detect a silent outage.
Scanning
Scans run on this app’s server (not on the OGEagleEye platform). The SDK checks local files, then POSTs a scan_result to your endpoint. The platform stores Scan reports and can alert on critical findings.
This is an integrity + PHP heuristics helper — not an antivirus.
use OGEagleEye\Monitor\OGEagleEye; $result = OGEagleEye::scan(['app', 'public'], [ 'root' => __DIR__, 'manifest_path' => __DIR__.'/.ogeagleeye-manifest.json', ]); OGEagleEye::flush();
Run it from cron / a scheduled task on this host (for example daily). More detail: docs/scanning.md.