PHP code example of astrotomic / laravel-dns

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

    

astrotomic / laravel-dns example snippets


use Astrotomic\Dns\Facades\Dns;

/** @var \Illuminate\Support\Collection $records */
$records = Dns::records('astrotomic.info', DNS_A);

use Astrotomic\Dns\Rules\DnsRecordExists;
use Spatie\Dns\Records\A;
use Spatie\Dns\Records\TXT;

return [
    'url' => [
        '// and a TXT record with the users token
        DnsRecordExists::make()
            ->expect(DNS_A|DNS_AAAA|DNS_CNAME)
            ->expect(DNS_TXT, fn(TXT $record): bool => $record->txt() === 'token='.$this->user()->public_token),
    ],
    'email' => [
        'in
        // has an A record
        // pointing to our IP-address
        DnsRecordExists::make()
            ->expect(DNS_A, fn(A $record): bool => $record->ip() === '127.0.0.1'),
    ],
    'something' => [
        '

use Astrotomic\Dns\Domain;

protected $casts = [
    'domain' => Domain::class,
];

use Astrotomic\Dns\Domain;

/** @var \Astrotomic\Dns\Domain $domain */
$domain = Domain::make('[email protected]');

/** @var string|null $domain */
$domain = Domain::parse('[email protected]');