-
Notifications
You must be signed in to change notification settings - Fork 30
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
Showing
6 changed files
with
179 additions
and
24 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 |
---|---|---|
@@ -1,15 +1,20 @@ | ||
# CHANGELOG | ||
|
||
## 1.0.0 | ||
- Initial release | ||
- Added test cases. | ||
- Update EmailChecker to handle domain validations. | ||
- Added docs. | ||
## 2.0.0 | ||
- Helper added to enhance checking of dispossable emails. | ||
- Added deep check option in checkDisposableEmail() method. | ||
- Large dispossable email list has been added to gist and it is directly used with package. | ||
|
||
## 1.2.0 | ||
- Added license inside composer.json | ||
- Facade updated composer.json | ||
|
||
## 1.1.0 | ||
- Added License.md | ||
- Added Security.md | ||
|
||
## 1.2.0 | ||
- Added license inside composer.json | ||
- Facade updated composer.json | ||
## 1.0.0 | ||
- Initial release | ||
- Added test cases. | ||
- Update EmailChecker to handle domain validations. | ||
- Added docs. |
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 |
---|---|---|
|
@@ -9,7 +9,7 @@ Nowadays most of websites are using registration process where they need to veri | |
|
||
## Installation | ||
|
||
Laravel Exceptions requires [PHP](https://php.net) > 7.0. This particular version supports with latest [Laravel](https://laravel.com/). | ||
Email Checker requires [PHP](https://php.net) > 7.0. This particular version supports with latest [Laravel](https://laravel.com/). | ||
|
||
To get the latest version, simply require the project using [Composer](https://getcomposer.org): | ||
|
||
|
@@ -21,17 +21,23 @@ Once installed, You need to include `Aman\EmailVerifier\EmailChecker` to access | |
|
||
## Usage | ||
|
||
#### Check Disposable Emails | ||
### Check Disposable Emails | ||
|
||
If you want to check email is [disposable emails](https://en.wikipedia.org/wiki/Disposable_email_address) or not then you can use the following function of [emailchecker](https://github.com/aman00323/email-verifier/) | ||
|
||
***Added new option to check disposable emails*** | ||
|
||
This option is part of checkDisposableEmail() method, you need to pass second argument as true. | ||
|
||
When you pass true inside helper will check emails with list of dispossable. which are hosted on gist, So whenever list will be changed you would't have to update package. | ||
|
||
``` | ||
app(EmailChecker::class)->checkDisposableEmail('[email protected]')); | ||
app(EmailChecker::class)->checkDisposableEmail('[email protected]','boolean')); | ||
``` | ||
|
||
This email verification will be done on the basis of [disposable emails](https://en.wikipedia.org/wiki/Disposable_email_address) list, This function will check if entered email address is in the list of disposable or not. | ||
|
||
#### Check DNS And MX Records | ||
### Check DNS And MX Records | ||
|
||
Another usage is to check [DNS](https://en.wikipedia.org/wiki/Domain_Name_System) and [MX Record](https://en.wikipedia.org/wiki/MX_record) of the email address, In this method package will try to extract records from email address and try to verify using [SMTP](https://en.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol). | ||
|
||
|
@@ -44,7 +50,7 @@ This will return array with success and details, Details will indicate email ver | |
|
||
For better output your server needs to support [fsockopen()](https://www.php.net/manual/en/function.fsockopen.php). | ||
|
||
#### Check Domain Status | ||
### Check Domain Status | ||
|
||
Sometime it is hard to identify that email exist or not based on DNS and MX Records, So this method will check the domain status using [cURL](https://www.php.net/manual/en/book.curl.php). | ||
|
||
|
@@ -56,26 +62,29 @@ app(EmailChecker::class)->checkDomain('[email protected]')); | |
|
||
This method will return TRUE or FALSE, if it successfully get response then it will return TRUE. Response validates based on [HTTP Status Code](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes). | ||
|
||
#### Check Email | ||
### Check Email | ||
|
||
This method will use all of the methods and it gives detail response, if it gives TRUE. | ||
|
||
If any of the method will respond with FALSE then will not give detail report. | ||
|
||
``` | ||
app(EmailChecker::class)->checkEmail('[email protected]')); | ||
app(EmailChecker::class)->checkEmail('[email protected]','boolean')); | ||
``` | ||
|
||
|
||
As we have added new option with checkDisposableEmail() which has second argument that will enable deep check to compare domain with large list. | ||
|
||
Don't worry it would't take too much time. :) | ||
|
||
All are different method you can use individually as per your requirement. To call all of the method at once use **Check Email** | ||
|
||
## Future Developement | ||
|
||
Planning to add more disposable email list in next release. | ||
Please let add your ideas to improve this package. | ||
|
||
## Contribution | ||
|
||
All contributer are appreciated, Code must follow [PSR2](https://www.php-fig.org/psr/psr-2/). create feature branch to compare with email checker. Your code must pass testcases. | ||
All contributer are welcome, Code must follow [PSR2](https://www.php-fig.org/psr/psr-2/). create feature branch to compare with email checker. Your code must pass testcases. | ||
|
||
**NOTE** : This package will not ensure to verify each and email address, some of them cannot be verify due to MAIL server securities. | ||
|
||
|
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,10 +1,26 @@ | ||
{ | ||
"name": "aman00323/emailchecker", | ||
"description": "Laravel package for checking email address is exist or not in real world", | ||
"keywords": [ | ||
"email validation", | ||
"disposable email checker", | ||
"php email verifier", | ||
"email exist or not", | ||
"disposable emails", | ||
"email verification" | ||
], | ||
"homepage": "https://github.com/aman00323/email-checker", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Aman Nurani", | ||
"email": "[email protected]", | ||
"role": "Software Engineer" | ||
} | ||
], | ||
"require": { | ||
"php": ">=7.0.0" | ||
}, | ||
"license": "MIT", | ||
"minimum-stability": "stable", | ||
"prefer-stable": true, | ||
"autoload": { | ||
|
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
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,119 @@ | ||
<?php | ||
|
||
namespace Aman\EmailVerifier\Helpers; | ||
|
||
class Helper | ||
{ | ||
public static function deepCheck(String $domain) | ||
{ | ||
$startingCharacter = strtolower(substr($domain, 0, 1)); | ||
switch ($startingCharacter) { | ||
case '0': | ||
$url = "https://gist.githubusercontent.com/aman00323/7550b32d9334313f83fa249b8c72eb42/raw/d6c34c69facfd4a746a60839977af5a595744508/0.json"; | ||
break; | ||
case '1': | ||
$url = "https://gist.githubusercontent.com/aman00323/a1d5528be50a326c363d6124a8e5644a/raw/5bc33a72d2a96d5f0342527cef4be2425f608bf7/1.json"; | ||
break; | ||
case '2': | ||
$url = "https://gist.githubusercontent.com/aman00323/e86377dd8a9cf242c21bb04708997564/raw/2693b5d91b18b7299deef825d976e873b8b6fd0b/2.json"; | ||
break; | ||
case '3': | ||
$url = "https://gist.githubusercontent.com/aman00323/cc0efa32545d22b24d64e7c2d869f192/raw/e697bced78526477e3407e323200f70e5b14b85c/3.json"; | ||
break; | ||
case '4': | ||
$url = "https://gist.githubusercontent.com/aman00323/24f90c36d8a4a45bf9da5b3fc0dd10c9/raw/5abf47393585b98a6b688fc2189bc1800ae1c26b/4.json"; | ||
break; | ||
case '9': | ||
$url = "https://gist.githubusercontent.com/aman00323/4616904635e4a2c27b80938cc2df63f0/raw/86aca2961cd102b94bb6f604665a066a83768823/9.json"; | ||
break; | ||
case 'a': | ||
$url = "https://gist.githubusercontent.com/aman00323/cabaa64263022478c7c68d42d746e2b5/raw/b9508986160ccb2417339955a36927549a3acc82/a.json"; | ||
break; | ||
case 'b': | ||
$url = "https://gist.githubusercontent.com/aman00323/43333bac0b8f74639d16817fe5135ca9/raw/5abd474e76094389a8ec98aac667bd76311751d4/b.json"; | ||
break; | ||
case 'c': | ||
$url = "https://gist.githubusercontent.com/aman00323/f4ccfa5b3ad08d6085fca8744737147d/raw/dd451a873a2c238586048f6330c63dc22f264a08/c.json"; | ||
break; | ||
case 'd': | ||
$url = "https://gist.githubusercontent.com/aman00323/94abf4c0575f55223ff3f9bd57f64da5/raw/25cffcfdcebd5a26113943268fe15dcd79445347/d.json"; | ||
break; | ||
case 'e': | ||
$url = "https://gist.githubusercontent.com/aman00323/b41f61d07c8ee91606a3bc7d0a666af1/raw/7ae40e1507827e61061185c6c0ff5ab7c400a824/e.json"; | ||
break; | ||
case 'f': | ||
$url = "https://gist.githubusercontent.com/aman00323/ee4d2036450489fb884a2f628f002509/raw/8912481d022aae5426ab579f7cfe6f2cc6ea0f6b/f.json"; | ||
break; | ||
case 'g': | ||
$url = "https://gist.githubusercontent.com/aman00323/30e766e164b91a31896d98d686aa7881/raw/6bc196476a3bc30b9be6b344877438cdec1f949f/g.json"; | ||
break; | ||
case 'h': | ||
$url = "https://gist.githubusercontent.com/aman00323/b170821a66bdd59ecf2083b45a6e25eb/raw/e02e7aec9bcbe2365b016e8199fb4a976edf2eea/h.json"; | ||
break; | ||
case 'i': | ||
$url = "https://gist.githubusercontent.com/aman00323/aa4a84e3ef24d6e81b0200650e799bec/raw/e952769a03192500dbbe961502cb9922f298c336/i.json"; | ||
break; | ||
case 'j': | ||
$url = "https://gist.githubusercontent.com/aman00323/f99539b5259668222593bc1f7a0b7bc5/raw/a26598657e53729a0e1ea63b5472521401748c8d/j.json"; | ||
break; | ||
case 'k': | ||
$url = "https://gist.githubusercontent.com/aman00323/061f74f1d745e6b7b53b9ce887e74bda/raw/82c4707a7566895bbfdca9e1a66bfe84fb3ebd41/k.json"; | ||
break; | ||
case 'l': | ||
$url = "https://gist.githubusercontent.com/aman00323/81ee01fcecacf40621255e3e944fd466/raw/5e1a051535c487edea0d8bac317dc2daf34ba6c2/l.json"; | ||
break; | ||
case 'm': | ||
$url = "https://gist.githubusercontent.com/aman00323/3569bd5fc1fe62eafa9070478afd6612/raw/ef7300d388ed60ec6cc63c854a60e5e57046ff49/m.json"; | ||
break; | ||
case 'n': | ||
$url = "https://gist.githubusercontent.com/aman00323/d7195298f1b3a43de9add4c02a6ef81e/raw/41a4d8d949b22e279ce1a6225ff7ebcc28d22ca6/n.json"; | ||
break; | ||
case 'o': | ||
$url = "https://gist.githubusercontent.com/aman00323/231dee6631bb9c918b25f459a2807524/raw/47fa82693853f1b068a4072c52d495d196ba1418/o.json"; | ||
break; | ||
case 'p': | ||
$url = "https://gist.githubusercontent.com/aman00323/6efecb5dc310744fa68920412eaed704/raw/f82b80e4538d76fc90a413c4fdbad2766fcc3c36/p.json"; | ||
break; | ||
case 'q': | ||
$url = "https://gist.githubusercontent.com/aman00323/2059b7492b8680991f7a010dc9dc5d1f/raw/e06414c193fab55aeabb9b397f79d670e75444d9/q.json"; | ||
break; | ||
case 'r': | ||
$url = "https://gist.githubusercontent.com/aman00323/8af0d42bd7f7a28f9bce31226005eada/raw/8bbc0b1475ef1eccff67720f431a339f11193df0/r.json"; | ||
break; | ||
case 's': | ||
$url = "https://gist.githubusercontent.com/aman00323/a53320b73698cb9f0fd950584ad1306c/raw/80afa84b8ac6561a3717717554e386a8ab5f0975/s.json"; | ||
break; | ||
case 't': | ||
$url = "https://gist.githubusercontent.com/aman00323/5dc41bbbebbd7775e6c6a4304debf160/raw/87d281b8c33ce5c5eee8918933e8adf1e52abd43/t.json"; | ||
break; | ||
case 'u': | ||
$url = "https://gist.githubusercontent.com/aman00323/4a58e775d8841037cc2420055b69df7a/raw/af84ed99dccab7fb4f7cb7ec9a5bae23f7096ee0/u.json"; | ||
break; | ||
case 'v': | ||
$url = "https://gist.githubusercontent.com/aman00323/e019b8059addce2d3f5ef19fc14abdb1/raw/d1d7c32c9c7ff30d1339dc6e9ea79d7ef4f2aebc/v.json"; | ||
break; | ||
case 'w': | ||
$url = "https://gist.githubusercontent.com/aman00323/4947d64ba553d3251275ab74ce3aa607/raw/96dd2f4adfa82e4eae84692ffb196cdd10948e44/w.json"; | ||
break; | ||
case 'x': | ||
$url = "https://gist.githubusercontent.com/aman00323/33bdf608e139be2abfaacfc63d88460f/raw/043571a7849c4ae5872d26b9328b88d213a03ba9/x.json"; | ||
break; | ||
case 'y': | ||
$url = "https://gist.githubusercontent.com/aman00323/77ad143b07e73e7f6b7f3baf8c79d305/raw/c84d6145105bc4b3c50c9e65bf36401c508380b9/y.json"; | ||
break; | ||
case 'z': | ||
$url = "https://gist.githubusercontent.com/aman00323/6c02172e91fe1365d76cdf10ba8248c0/raw/1d3cb8c05a0dae9eaec332d70ba5ebf9c769345c/z.json"; | ||
break; | ||
default: | ||
return false; | ||
} | ||
$data = json_decode(file_get_contents($url), true); | ||
for ($i = 0; $i < count($data); $i++) { | ||
if (preg_match("/(" . $data[$i] . ")/i", $domain)) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
|
||
} | ||
} |
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