tintnaingwin / email-checker
Laravel Package To Validate If An Email Address Exists Without Sending An Email
Installs: 54 132
Dependents: 1
Suggesters: 0
Security: 0
Stars: 51
Watchers: 3
Forks: 21
Open Issues: 5
Requires
- php: ^7.0
- ext-json: *
- illuminate/support: ~5.5.0|~5.6.0|~5.7.0|~5.8.0|^6.0
- illuminate/validation: ~5.5.0|~5.6.0|~5.7.0|~5.8.0|^6.0
- tintnaingwin/email-checker-php: ^1.0
Requires (Dev)
- mockery/mockery: ^1.0
- orchestra/testbench: ^3.5|^4.0
- phpunit/phpunit: ^6.0|^7.0|^8.0
This package is auto-updated.
Last update: 2024-11-05 10:23:40 UTC
README
Notice - That extracts the MX records from the email address and connect with the mail server to make sure the mail address accurately exist. So it may be slow loading time in local and some co-operate MX records take a long time.
You can install the package via composer:
composer require tintnaingwin/email-checker
The package will automatically register itself.
Translations
If you wish to edit the package translations, you can run the following command to publish them into your resources/lang
folder
php artisan vendor:publish --provider="Tintnaingwin\EmailChecker\EmailCheckerServiceProvider"
Features
This package supports:
- Validate with SMTP
- Support for Disposable Email
Usage
Form Request Validation
To add 'email_checker' at email attribute
// [your site path]/app/Http/Requests/RegisterRequest.php public function rules() { return [ 'name' => 'required|string|max:255', 'email' => 'required|string|email|max:255|unique:users|email_checker', 'password' => 'required|string|min:6|confirmed', ]; }
In a RegisterController
// [your site path]/app/Http/Controllers/Auth/RegisterController.php protected function validator(array $data) { return Validator::make($data, [ 'name' => ['required', 'string', 'max:255'], 'email' => 'required|string|email|max:255|unique:users|email_checker', 'password' => ['required', 'string', 'min:8', 'confirmed'], ]); }
Using Rule Objects
use TintNaingWin\EmailChecker\Rules\EmailExist; $request->validate([ 'email' => ['required', 'string', 'email', 'max:255', 'unique:users', new EmailExist], ]);
Usage With Facade
You can also check check email manually:
// reture boolean EmailChecker::check('me@example.com');
Testing
Run the tests with:
composer test
Credit
- Disposable Email List
Changelog
Please see CHANGELOG for more information on what has changed recently.
Security
If you discover any security-related issues, please email amigo.k8@gmail.com instead of using the issue tracker.
License
The MIT License (MIT). Please see License File for more information.