PHP code example of elegantly / laravel-kpi

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

    

elegantly / laravel-kpi example snippets


return [

    /*
    |--------------------------------------------------------------------------
    | Discover Definitions
    |--------------------------------------------------------------------------
    |
    | If enabled is set to true, your KPI definitions will be automatically discovered when taking snapshot.
    | Customize the path to indicate the directory where your definitions are located in your app.
    | The KPI definitions will be discovered from the path and its subdirectories
    |
    */
    'discover' => [
        'enabled' => true,
        /**
         * This path will be used with `app_path` helper like `app_path('Kpis')`
         */
        'path' => 'Kpis',
    ],

    /*
    |--------------------------------------------------------------------------
    | Registered Definitions
    |--------------------------------------------------------------------------
    |
    | You can manually register your kpi definitions if you are not using "auto-discover"
    | or if you want to add more deifnitions not stored in the main path
    |
    */
    'definitions' => [],
];

$schedule->command(SnapshotKpisCommand::class, [
    'interval'=> KpiInteval::Minute
])->everyMinute();

$schedule->command(SnapshotKpisCommand::class, [
    'interval'=> KpiInteval::Hour
])->hourly();
bash
php artisan vendor:publish --tag="kpi-migrations"
php artisan migrate
bash
php artisan vendor:publish --tag="kpi-config"