A Laravel package for validating domain properties
It allows easy integration of the PHP Domain Parser PHP Domain Parser by Jeremy Kendall into a Laravel app, in order to validate values against known
The package can be installed via composer:
composer require myerscode/laravel-domain-validator
Fetch data sets
artisan domain-validator:cache
Cache the fetched data sets
artisan domain-validator:cache
Do both together!
artisan domain-validator:refresh
It is recommended to schedule the refresh command, in order to remove the need of running the domain-validator:refresh
command
every time you need to update your cache.
Keeping the sources of truth (the )
// routes/console.php
Schedule::call('domain-validator:refresh')->daily();
// alternatively initialize a new command class
Schedule::call(new \Myerscode\Laravel\DomainValidator\Commands\RefreshCommand)->daily();
Note: For developer experience, all strings passed will be sanitized to remove trailing slashes /
and http(s)://
.
Is the value recognized valid a valid TLD suffix recognized by the Internet Corporation for Assigned Names and Numbers (ICANN) as....
Tells whether the effective TLD has a matching rule in a Public Suffix List ICANN Section.
hasICANNSuffix('myerscode.com') // true
hasICANNSuffix('cloudfront.net') // false
Tells whether the effective TLD has a matching rule in a Public Suffix List.
For more information i go to the Public Suffix section
hasKnownSuffix('myerscode.co') // true
hasKnownSuffix('myerscode.corgi') // false
Tells whether the effective TLD has a matching rule in a Public Suffix List Private Section.
hasPrivateSuffix('myerscode.cloudfront.net') // true
hasPrivateSuffix('cloudfront.net') // false
Is the value parseable as to a valid domain
isDomain('myerscode.com') // true
isDomain('.com') // false
Is the value a valid Top Level Domain
isTld('.com') // true
isTld('.corgi') // false
Bug reports and feature requests can be submitted on the Github Issue Tracker.
We are very happy to receive pull requests to add functionality or fixes. Please read the Myerscode contributing guide for information.
The MIT License (MIT). Please see License File for more information.