PHP code example of kodamity / laravel-api-usage-pulse

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

    

kodamity / laravel-api-usage-pulse example snippets


return [
    // ...
    
    'recorders' => [
        // Existing recorders...
        
        \Kodamity\Libraries\ApiUsagePulse\Recorders\RequestsStatistics::class => [
            'enabled' => env('PULSE_KDM_API_USAGE_REQUESTS_STATISTICS_ENABLED', true),
            'sample_rate' => env('PULSE_KDM_API_USAGE_REQUESTS_STATISTICS_SAMPLE_RATE', 1),
            'ignore' => [
                '#^/pulse$#', // Pulse dashboard...
            ],
        ],
    ],
];

return [
    // ...
    
    'recorders' => [
        // Existing recorders...
        
        \Kodamity\Libraries\ApiUsagePulse\Recorders\ResponsesStatistics::class => [
            'enabled' => env('PULSE_KDM_API_USAGE_RESPONSES_STATISTICS_ENABLED', true),
            'sample_rate' => env('PULSE_KDM_API_USAGE_RESPONSES_STATISTICS_SAMPLE_RATE', 1),
            'ignore' => [
                '#^/pulse$#', // Pulse dashboard...
            ],
            'records' => [
                \Kodamity\Libraries\ApiUsagePulse\Enums\ResponseStatusGroup::Informational->value,
                \Kodamity\Libraries\ApiUsagePulse\Enums\ResponseStatusGroup::Successful->value,
                \Kodamity\Libraries\ApiUsagePulse\Enums\ResponseStatusGroup::Redirection->value,
                \Kodamity\Libraries\ApiUsagePulse\Enums\ResponseStatusGroup::ClientError->value,
                \Kodamity\Libraries\ApiUsagePulse\Enums\ResponseStatusGroup::ServerError->value,
            ],
        ],  
    ],
];

<livewire:kodamity.pulse.api-usage.requests-summary cols="5" rows="2" />

<livewire:kodamity.pulse.api-usage.response-statuses-graph cols="7" />

<livewire:kodamity.pulse.api-usage.response-times-graph cols="7" />
bash
php artisan vendor:publish --tag=pulse-dashboard