Skip to content

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
lennyrouanet committed Apr 14, 2022
1 parent cc42f56 commit c347f08
Show file tree
Hide file tree
Showing 13 changed files with 1,128 additions and 2 deletions.
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Dependencies
composer.lock
vendor/*

# Test
.phpunit*

# Dev
.DS_Store
.nova/*
88 changes: 86 additions & 2 deletions README.md
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
);
```
67 changes: 67 additions & 0 deletions component/Data/EmailServiceProvider.php
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',
// Google
'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',
];
}
Loading

0 comments on commit c347f08

Please sign in to comment.