equipc/laravel-email-validator

Validation rule to validate email for Laravel

5.4.0 2023-08-30 09:58 UTC

This package is auto-updated.

Last update: 2024-03-30 00:37:23 UTC


README

Validate email addresses in Laravel 7.x

Installation

  • The package could be installed via Composer
composer require equipc/laravel-email-validator
  • Publish the configuration file using the command below
php artisan vendor:publish --provider="EquiPC\EmailValidator\EmailValidatorServiceProvider" --tag="config"
  • Configure your Quick Email Verification key in your .env file. You can retrieve this API key from the Quick Email Verification control panel.
QUICKEMAILVERIFICATION_KEY=your-api-key

Usage

  • add the isValidEmail rule to the validator
'email' => 'required|email|isValidEmail'

Customizing the error message

If you want to modify the error message, you can publish the lang files with this command:

php artisan vendor:publish --provider="EquiPC\EmailValidator\EmailValidatorServiceProvider" --tag="lang"

This will publish this file to resources/lang/vendor/emailValidator/en/validation.php.

return [
	"is_invalid_email" => "This email is invalid.",
 ];

If you want to translate the values to, for example, French, just copy that file over to resources/lang/vendor/emailValidator/fr/validation.php and fill in the French translations.

Sandbox mode

You can enable sandbox mode in your .env file

QUICKEMAILVERIFICATION_SANDBOX=true