-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cc42f56
commit c347f08
Showing
13 changed files
with
1,128 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Dependencies | ||
composer.lock | ||
vendor/* | ||
|
||
# Test | ||
.phpunit* | ||
|
||
# Dev | ||
.DS_Store | ||
.nova/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,86 @@ | ||
# domain-name | ||
Domain name | ||
# Domain name | ||
|
||
## Requirments | ||
|
||
PHP >= 8.0 | ||
|
||
|
||
## Install | ||
|
||
`composer require phant/domain-name` | ||
|
||
## Usages | ||
|
||
### Domain name validation | ||
|
||
```php | ||
use Phant\DomainName\DataStructure\DomainName; | ||
use Phant\DomainName\Error\InvalidFormat; | ||
|
||
try { | ||
|
||
$domainName = new DomainName('domain.ext'); | ||
|
||
} catch (InvalidFormat $e) { | ||
|
||
// Domain name format is invalid | ||
|
||
} | ||
|
||
$domainName->getName(); | ||
$domainName->getExtension(); | ||
``` | ||
|
||
### DNS record | ||
|
||
```php | ||
use Phant\DomainName\DataStructure\DomainName; | ||
use Phant\DomainName\Error\InvalidFormat; | ||
use Phant\DomainName\Service\DnsRecord; | ||
|
||
try { | ||
|
||
$domainName = new DomainName('domain.ext'); | ||
|
||
} catch (InvalidFormat $e) { | ||
|
||
// Domain name format is invalid | ||
|
||
} | ||
|
||
$dnsRecordDetail = (new DnsRecord())->get( | ||
domainName, | ||
DnsRecord::A | ||
); | ||
|
||
$dnsRecordExist = (new DnsRecord())->exist( | ||
domainName, | ||
DnsRecord::A | ||
); | ||
``` | ||
|
||
### Service provided | ||
|
||
```php | ||
use Phant\DomainName\DataStructure\DomainName; | ||
use Phant\DomainName\Error\InvalidFormat; | ||
use Phant\DomainName\Service\ServiceProvided; | ||
|
||
try { | ||
|
||
$domainName = new DomainName('domain.ext'); | ||
|
||
} catch (InvalidFormat $e) { | ||
|
||
// Domain name format is invalid | ||
|
||
} | ||
|
||
$isEmailServiceProvider = (new ServiceProvided())->isEmailServiceProvider( | ||
domainName | ||
); | ||
|
||
$isTrashMailBoxService = (new ServiceProvided())->isTrashMailBoxService( | ||
domainName | ||
); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Phant\DomainName\Data; | ||
|
||
final class EmailServiceProvider | ||
{ | ||
const LIST = [ | ||
// AOL | ||
'aol.com', | ||
// Apple | ||
'me.com', | ||
'icloud.com', | ||
// Bouygues telecom | ||
'bbox.fr', | ||
// Darty box | ||
'dbmail.com', | ||
// Lliad | ||
'free.fr', | ||
'aliceadsl.fr', | ||
'libertysurf.fr', | ||
// Laposte | ||
'laposte.net', | ||
// GMX | ||
'gmx.fr', | ||
'gmail.com', | ||
'gmail.fr', | ||
// Mailoo | ||
'mailoo.org', | ||
// Microsoft | ||
'hotmail.fr', | ||
'hotmail.com', | ||
'hotmail.ca', | ||
'hotmail.cf', | ||
'hotmail.ch', | ||
'hotmail.de', | ||
'hotmail.mail', | ||
'hotmail.mail.fr', | ||
'live.fr', | ||
'outlook.fr', | ||
'msn.com', | ||
// Orange | ||
'wanadoo.fr', | ||
'wanadoo.com', | ||
'orange.fr', | ||
'fr.oleane.com', | ||
'nordnet.fr', | ||
'voila.fr', | ||
// SFR | ||
'sfr.fr', | ||
'neuf.fr', | ||
'club-internet.fr', | ||
'cegetel.net', | ||
'numericable.fr', | ||
'noos.fr', | ||
'9business.fr', | ||
// Yahho | ||
'yahoo.fr', | ||
'yahoo.com', | ||
'yahoo.co.in', | ||
'yahoo.com.cn', | ||
'yahoo.de', | ||
'ymail.com', | ||
'ymail.fr', | ||
]; | ||
} |
Oops, something went wrong.