PHP code example of funnydevjsc / laravel-email-filter

1. Go to this page and download the library: Download funnydevjsc/laravel-email-filter 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/ */

    

funnydevjsc / laravel-email-filter example snippets

 php


namespace App\Console\Commands;

use FunnyDev\EmailFilter\EmailFilterSdk;
use Illuminate\Console\Command;

class EmailFilterTestCommand extends Command
{
    protected $signature = 'email-filter:test';

    protected $description = 'Test EmailFilter SDK';

    public function __construct()
    {
        parent::__construct();
    }

    public function handle()
    {
        $instance = new EmailFilterSdk();
        
        // Perform checking with fast mode turned on and only use $result['recommended'] as signal (true/false)
        $result = $instance->validate('[email protected]', true);
        
        // Perform a full checking
        $result = $instance->validate('f*[email protected]', false);
        
        // Explanation of results
        $result = [
            'query' => $email,
            'recommend' => true, // Recommended value of whether to accept this email or not
            'trustable' => [
                'exist' => true, // Does the email exist
                'disposable' => false, // Is the email spam
                'blacklist' => 0, // Percentage of blacklists as a float
                'fraud_score' => 0, // Fraud score on a 100-point scale
                'suspicious' => false, // Is the email suspicious of maliciousness
                'high_risk' => false, // Is the email considered high risk of payment
                'domain_type' => 'popular',
                'domain_trust' => true, // Is the domain name trustworthy?
                'domain_age' => '',
                'dns_valid' => false, // Does DNS match between domain name and SMTP server?
                'username' => true // Is the email address username trustworthy?
            ]
        ];
    }
}