PHP code example of uptimex / laravel-client

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

    

uptimex / laravel-client example snippets


use Uptimex\Client\Facades\Uptimex;

Uptimex::sample(1.0); // capture this whole trace regardless of the rate

use Uptimex\Client\Facades\Uptimex;

public function boot(): void
{
    Uptimex::rejectQueries(fn (array $q) =>
        str_contains($q['sql_normalized'] ?? '', 'telescope_')
    );

    Uptimex::rejectCacheKeys(fn (array $c) =>
        str_starts_with($c['key'] ?? '', 'framework/')
    );
}

Uptimex::redactLogs(function (array $context) {
    unset($context['ssn'], $context['card_number']);

    return $context;
});

use Uptimex\Client\Facades\Uptimex;

// Start a trace manually (custom long-running scripts, workers, …)
Uptimex::startTrace('command', ['source' => 'cron-cleanup']);

// Record a custom event under the active trace
Uptimex::record('request', ['route' => '/checkout', 'duration_ms' => 42]);

// Run a block with capture paused
Uptimex::ignore(function () {
    // the SDK is silent inside this closure
});

// …or pause / resume manually
Uptimex::pause();
// noisy section
Uptimex::resume();

// End the trace and flush its batch
Uptimex::endTrace('ok');
bash
php artisan uptimex:test
bash
php artisan uptimex:agent
bash
php artisan vendor:publish --tag=uptimex-config
bash
php artisan uptimex:agent
dotenv
LOG_CHANNEL=stack
LOG_STACK=single,uptimex
dotenv
UPTIMEX_LOG_LEVEL=warning