1. Go to this page and download the library: Download gemorroj/ginfo 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 Ginfo\Ginfo;
use Ginfo\Info\InfoInterface;
use Ginfo\InfoParserInterface;
// class for parsed data
final readonly class SwooleInfo implements InfoInterface
{
public function __construct(private array $stats)
{
}
public function getStats(): array
{
return $this->stats;
}
}
// parser
final readonly class SwooleParser implements InfoParserInterface
{
public function run(): ?InfoInterface
{
$stats = \app('Swoole\Http\Server')->stats(); // laravel
return new SwooleInfo($stats);
}
}
$swooleParser = new SwooleParser();
$ginfo = new Ginfo(customParsers: [$swooleParser]);
/** @var SwooleInfo $data */
$data = $ginfo->getCustomParser(SwooleParser::class);
print_r($data->getStats());
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.