v3labs/company-email-validator

Company email validator

1.0.0 2023-12-26 11:39 UTC

This package is auto-updated.

Last update: 2024-04-26 15:06:14 UTC


README

The v3labs/company-email-validator package is a PHP library designed to validate whether an email address belongs to a company domain or not.

Installation

You can install the package via Composer:

composer require v3labs/company-email-validator

Usage

To use the Company Email Validator, instantiate the CompanyEmailValidator class and call the isValid method with the email address you want to validate. The validation process can be customized by enabling DNS checks for domain existence and specifying additional domains for more tailored validation.

<?php

$validator = new \V3labs\Validator\CompanyEmailValidator(
    checkDns: false,      // default
    additionalDomains: [] // default
);

$isCompanyEmail1 = $validator->isValid('john.doe@example.com'); // false
$isCompanyEmail2 = $validator->isValid('info@acme.com'); // true

Note

The validation is based on the presence of common free email domains, and emails matching these domains will be considered as non-company emails.