Skip to content
프로젝트

소개

Disposable email detection library for PHP

생산성 및 자동화

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

EmailChecker

Code quality... Downloads Packagist License MIT

PHP library to check if an email comes from a disposable email provider.

To detect invalid emails, it provides a built-in database of 1000+ disposable email providers, but you can also use your own data.

Installation

Via Composer:

composer require mattketmo/email-checker

Usage

Basic use of EmailChecker with built-in throwaway email list:

<?php

require __DIR__.'/vendor/autoload.php';

use EmailChecker\EmailChecker;

$checker = new EmailChecker();

$checker->isValid('[email protected]');     // true
$checker->isValid('[email protected]'); // false

Or using a custom adapter:

<?php

use EmailChecker\EmailChecker;
use EmailChecker\Adapter;

$checker = new EmailChecker(new Adapter\ArrayAdapter(array(
    'foo.org',
    'baz.net'
)));

$checker->isValid('[email protected]'); // true
$checker->isValid('[email protected]'); // false

You can build your own adapter (to use another database) simply by implementing the AdapterInterface.

Integration with Symfony

This library also provides a constraint validation for your Symfony project:

<?php

use EmailChecker\Constraints as EmailCheckerAssert;
use Symfony\Component\Validator\Constraints as Assert;

class User
{
    #[Assert\NotBlank] 
    #[EmailCheckerAssert\NotThrowawayEmail] 
    private string $email;
}

Integration with Laravel

To integrate this library with your Laravel project add the following line to the providers key within your config/app.php file:

EmailChecker\Laravel\EmailCheckerServiceProvider::class

If you would like to use the EmailChecker facade, you must also add the following line to the aliases key within your config/app.php file:

'EmailChecker' => EmailChecker\Laravel\EmailCheckerFacade::class

You can then use the library within your project like so:

<?php

class MyClass
{
	public function foo()
	{
        // Facade Access
        EmailChecker::isValid('[email protected]');

        // Container Access
        $checker = app()->make('email.checker');
        $checker->isValid('[email protected]');
    }

    public function getValidator(array $data)
    {
        // Not thow away validator
        return Validator::make($data, [
    	     'email' => 'required|email|not_throw_away'
    	]);
    }
}

List of some disposable emails database

License

EmailChecker is released under the MIT License. See the bundled LICENSE file for details.

관련 프로젝트 살펴보기

불러오는 중…