1. Go to this page and download the library: Download perfbase/codeigniter4 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/ */
perfbase / codeigniter4 example snippets
public bool $enabled = false;
public bool $debug = false;
public bool $logErrors = true;
public string $apiKey = '';
public string $apiUrl = 'https://ingress.perfbase.cloud';
public float $sampleRate = 0.1;
public int $timeout = 10;
public ?string $proxy = null;
public int $flags = FeatureFlags::DefaultFlags;
public string $appVersion = '';
public ?string $userResolver = null;
public array|string $profileHttpStatusCodes = ''; // normalized to [...range(200, 299), ...range(500, 599)]
public array $
namespace Config;
use Perfbase\CodeIgniter4\Config\Perfbase as BasePerfbase;
use Perfbase\SDK\FeatureFlags;
final class Perfbase extends BasePerfbase
{
public bool $enabled = true;
public bool $debug = false;
public bool $logErrors = true;
public string $apiKey = '';
public float $sampleRate = 0.2;
public int $timeout = 10;
public int $flags = FeatureFlags::DefaultFlags;
public string $appVersion = '1.0.0';
public array $profileHttpStatusCodes = [200, 201, 202, 204];
public array $excludeHttp = ['/health', '/up'];
public array $excludeConsole = ['cache:*', 'migrate:*'];
}
namespace App\Support;
use CodeIgniter\HTTP\RequestInterface;
use Perfbase\CodeIgniter4\Contracts\UserResolverInterface;
final class PerfbaseUserResolver implements UserResolverInterface
{
public function resolve(RequestInterface $request): ?string
{
return '123';
}
}
public ?string $userResolver = 'perfbaseUserResolver';
public ?string $userResolver = App\Support\PerfbaseUserResolver::class;