Concise ReactPHP DNS config with caching.
Install this package with Composer:
$ composer require nytris/dnsConfigure Nytris platform:
nytris.config.php
<?php
declare(strict_types=1);
use Nytris\Boot\BootConfig;
use Nytris\Boot\PlatformConfig;
use Nytris\Cache\Adapter\ReactCacheAdapter;
use Nytris\Dns\Dns;
use React\Socket\Connector;
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
$bootConfig = new BootConfig(new PlatformConfig(__DIR__ . '/var/cache/nytris/'));
$bootConfig->installPackage(new MyNytrisPackage(
// Using Nytris Cache & Symfony Cache adapters as an example.
connectorFactory: fn (string $cachePath) => new Connector([
'dns' => (new Dns())->createResolver(
new ReactCacheAdapter(
new FilesystemAdapter(
'my_cache_key',
0,
$cachePath
)
)
),
])
));
return $bootConfig;