PHP code example of ogeagleeye / monitor-php
1. Go to this page and download the library: Download ogeagleeye/monitor-php library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ogeagleeye / monitor-php example snippets
use OGEagleEye\Monitor\OGEagleEye;
_KEY_FROM_ADMIN',
'endpoint' => 'https://your-host/api/v1/events',
'environment' => 'production', // optional
]);
OGEagleEye::init([
'key' => getenv('OGEAGLEEYE_KEY'),
'endpoint' => getenv('OGEAGLEEYE_ENDPOINT'),
]);
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');
OGEagleEye::captureMessage('hello', 'info', ['order_id' => 42]);
use OGEagleEye\Monitor\OGEagleEye;
OGEagleEye::heartbeat();
OGEagleEye::flush();
use OGEagleEye\Monitor\OGEagleEye;
$result = OGEagleEye::scan(['app', 'public'], [
'root' => __DIR__,
'manifest_path' => __DIR__.'/.ogeagleeye-manifest.json',
]);
OGEagleEye::flush();
bash
composer