PHP code example of nytris / dns

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

    

nytris / dns example snippets




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;