PHP code example of devpulse / core

1. Go to this page and download the library: Download devpulse/core 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/ */

    

devpulse / core example snippets


use DevPulse\Client;

$client = new Client([
    'dsn'         => 'https://your-devpulse-host/api/ingest/YOUR_API_KEY',
    'environment' => 'production',
    'release'     => '1.0.0',   // optional
    'async'       => true,      // fire-and-forget via register_shutdown_function (default)
    'timeout'     => 2,         // HTTP timeout in seconds
]);

// Register global error/exception/shutdown handlers
$client->register();

try {
    riskyOperation();
} catch (\Throwable $e) {
    $client->captureException($e, ['order_id' => $orderId]);
}

$client->captureMessage('Payment gateway timeout', 'warning', ['gateway' => 'stripe']);

use DevPulse\DevPulse;

DevPulse::init([
    'dsn'         => 'https://your-devpulse-host/api/ingest/YOUR_API_KEY',
    'environment' => 'production',
]);

DevPulse::captureException($e);
DevPulse::captureMessage('Something happened', 'info');