Skip to content

unicodeveloper/laravel-email-validator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
Nov 1, 2015
Nov 1, 2015
Nov 1, 2015
Nov 1, 2015
Nov 1, 2015
Nov 1, 2015
Nov 1, 2015
Nov 1, 2015
Nov 1, 2015
Nov 1, 2015
Nov 1, 2015

Repository files navigation

laravel-email-validator

Latest Stable Version License Build Status Quality Score Total Downloads

Laravel 5 Package to help validate and verify your email addresses.

Install

PHP 5.5+ or HHVM 3.3+, and Composer are required.

Via Composer

$ composer require unicodeveloper/laravel-email-validator

Another alternative is to simply add the following line to the require block of your composer.json file.

"unicodeveloper/laravel-email-validator": "1.0.*"

Then run composer install or composer update to download it and have the autoloader updated.

Add this to your providers array in config/app.php

// Laravel 5: config/app.php

'providers' => [
    ...
    'Unicodeveloper\EmailValidator\EmailValidatorServiceProvider',
    ...
];

This package also comes with a facade

// Laravel 5: config/app.php

'aliases' => [
    ...
    'EmailValidator' => 'Unicodeveloper\EmailValidator\EmailValidatorFacade',
    ...
]

Publish the config file by running:

php artisan vendor:publish

The config file will now be located at config/emailValidator.php.

Configuration

This is the emailValidator.php file in the config directory. Go to quickemailverification.com, sign up, get an api Key and insert here

/**
 *  Config file that a user/developer can insert quickemailverficationservice api key
 */
return [
    'apiKey' => ''
];

Usage

With the Facades, all you need to do in your application is something like so:

 if( EmailValidator::verify('kkkkk@example.com')->isValid()[0] ){
   ......
 }

 // returns a true/false if the email address is valid or not

Other Methods Available

/**
 * Returns true or false if the email address uses a disposable domain
 * @return boolean
 */
EmailValidator::verify('kkkkk@example.com')->isDisposable()
/**
 * Returns true or false if the API request was successful
 * @return boolean
 */
EmailValidator::verify('kkkkk@example.com')->apiRequestStatus()
/**
 * Get the domain of the provided email address
 * @return string
 */
EmailValidator::verify('kkkkk@example.com')->getDomainName()
/**
 * Get the local part of an email address
 * Example: prosperotemuyiwa@gmail.com returns prosperotemuyiwa
 * @return string
 */
EmailValidator::verify('kkkkk@example.com')->getUser()
/**
 * Gets a normalized version of the email address
 * Example: ProsperOtemuyiwa@gmail.com returns prosperotemuyiwa@gmail.com
 * @return string
 */
EmailValidator::verify('kkkkk@example.com')->getEmailAddress()
/**
 * Returns true if the domain appears to accept all emails delivered to that domain
 * @return boolean
 */
EmailValidator::verify('kkkkk@example.com')->acceptEmailsDeliveredToDomain()
/**
 * Returns true or false if email address is a role address
 * Example manager@example.com , ceo@example.com will return true
 * @return boolean
 */
EmailValidator::verify('kkkkk@example.com')->isRole()

Change log

Please see CHANGELOG for more information what has changed recently.

Todo: Testing

You can run the tests with:

vendor/bin/phpunit run

Alternatively, you can run the tests like so:

composer test

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.

About

📧 📦 Validate email addresses on the fly in Laravel 5

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages