PHP code example of eusonlito / disposable-email-validator

1. Go to this page and download the library: Download eusonlito/disposable-email-validator library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

eusonlito / disposable-email-validator example snippets




usonlito\DisposableEmail\Check;

// Simple
// Validate emailFilter, domain and wildcard

Check::email('[email protected]'); // true
Check::email('[email protected]'); // false

// Other methods

Check::emailFilter('[email protected]');     // Validate email with filter_var
Check::emailExpression('[email protected]'); // Validate email with regular expression
Check::domain('my-email.com');             // Validate domain and wildcard domains
Check::wildcard('my-email.com');           // Validate only wildcard domains


'providers' => [
    ...

    Eusonlito\DisposableEmail\Laravel\DisposableEmailServiceProvider::class

    ...
];


use InvalidArgumentException;
use Eusonlito\DisposableEmail\Check;

class Signup
{
    public function validate(Request $request)
    {
        if (!Check::email($request->input('email'))) {
            throw new InvalidArgumentException('Invalid email');
        }
    }

    public function getValidator(array $data)
    {
        return Validator::make($data, [
             'email' => '