1. Go to this page and download the library: Download nadi-pro/nadi-php 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/ */
use App\Metrics\Http;
use Nadi\Metric\Metric;
$metric = new Metric();
$metric->add(new Http());
$metric->toArray();
'metrics' => [
\App\Metrics\Http::class,
];
use Nadi\Sampling\Config;
$config = new Config(
samplingRate: 0.1,
baseRate: 0.05,
loadFactor: 1.0,
intervalSeconds: 60
);
use Nadi\Sampling\FixedRateSampling;
$samplingStrategy = new FixedRateSampling($config);
if($samplingStrategy->shouldSample()) {
// do something
}
use Nadi\Sampling\SamplingManager;
$samplingManager = new SamplingManager($samplingStrategy);
if($samplingManager->shouldSample()) {
// do something
}
namespace App\Sampling;
use Nadi\Sampling\Contract;
use Nadi\Sampling\Config;
class CustomSampling implements Contract
{
public function __construct(protected Config $config) {}
public function shouldSample(): bool
{
// do your logic hhere
return true;
}
}
bash
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.