Integrations

Laravel integration

A Laravel validation rule, ValidEmail, fails an address that cannot receive email in any form request or Validator::make call. It is built on our PHP client library, checks each address once, and lets a real person through when the API cannot answer in time.

  • Status: Setup guide
  • One rule after Laravel’s email rule

Form requestPHP

Install and use
composer config repositories.email-validation-laravel artifact ./packages
composer require email-validation/laravel:^0.1

# .env
EV_API_KEY=your-api-key

# in your validation rules
'email' => ['bail', 'required', 'email', new ValidEmail()],
'email' => 'bail|required|email|valid_email:invalid,disposable',

At a glance.

Status
Setup guide. Not listed on a marketplace yet: you set it up yourself in a few steps, below and in the full guide.
For
Laravel developers who want sign-up, checkout and contact forms to refuse addresses that cannot receive mail, without a slow or failed check ever blocking a real person.
You need
Laravel 10 or newer, PHP 8.1 or newer, Composer, and an API key made for it, with a daily credit cap, with the permission Validate addresses, set as EV_API_KEY in .env.
Costs
1 credit = 1 validated address, as with any API request. Free: unknown results, API errors, malformed addresses and test addresses on sandbox.email-validation.org.
Full guide
Read the full setup guide

Typical uses.

Set it up. 5 steps.

The short version of the full setup guide, which stays the reference when a step does not match what you see.

  1. Download the package

    The package is not on Packagist yet: download it from the guide and save it in a folder of your project, such as packages/.

  2. Require it

    Add that folder as a Composer repository with composer config repositories.email-validation-laravel artifact ./packages, then run composer require email-validation/laravel:^0.1. Laravel discovers the service provider by itself.

  3. Set your key

    Create an API key with Validate addresses and a daily credit cap, and put it in .env as EV_API_KEY. The key is read from your configuration only; never put it in code.

  4. Add the rule

    Add new ValidEmail(), or the string rule valid_email, after Laravel’s own email rule, with bail so a malformed address is never sent.

  5. Try it for free

    Send the form with accepted@sandbox.email-validation.org, which passes, and no_mailbox@sandbox.email-validation.org, which fails. Test addresses cost nothing.

Good to know.

Updated · Maintained by the email-validation.org team