jezzdk/laravel-domain-validator

1.3 2020-03-13 21:44 UTC

This package is auto-updated.

Last update: 2024-04-10 20:57:28 UTC


README

A simple domain validator for Laravel 6.7 and above.

Note: DomainActive doesn't work as expected on Alpine Linux (docker-library/php#442)

Domain

Checks if a string is a valid domain name.

DomainActive

Does the same as above but also does a checkdnsrr() against the domain to see if it resolves to an A record.

Usage

use Jezzdk\Laravel\Validator\Domain;
use Jezzdk\Laravel\Validator\DomainActive;

$request->validate([
    'domain' => ['required', 'string', new Domain],
]);

$request->validate([
    'domain' => ['required', 'string', new DomainActive],
]);