nytris / dns
Installs: 2 087
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:project
Requires
- php: >=8.1
- react/cache: ^1.2
- react/dns: ^1.13
Requires (Dev)
- mockery/mockery: 1.6.11
- phpstan/phpstan: ^1.10
- phpstan/phpstan-mockery: ^1.1
- phpunit/phpunit: ^10.2
- symfony/cache: ^5.4
README
Concise ReactPHP DNS config with caching.
Usage
Install this package with Composer:
$ composer require nytris/dns
When using Nytris platform (recommended)
Configure 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;