PHP code example of webpatser / fledge-pulse

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

    

webpatser / fledge-pulse example snippets


use Laravel\Pulse\Contracts\Storage;
use Laravel\Pulse\Fiber\Storage\StorageManager;

public function boot(): void
{
    $this->app->make(StorageManager::class)->extend('clickhouse', function ($app): Storage {
        return new ClickHouseStorage($app['config']->get('pulse.storage.clickhouse'));
    });
}

use Laravel\Pulse\Fiber\Livewire\Concerns\RemembersConcurrently;

$results = $this->rememberMany([
    'all' => fn ($interval) => Pulse::aggregate('cache_hit', ['count'], $interval),
    'keys' => fn ($interval) => Pulse::aggregate('cache_hit', ['count'], $interval, limit: 25),
]);

[$all, $allTime, $allRunAt] = $results['all'];