PHP code example of nilanjan-k / tempmailblocker

1. Go to this page and download the library: Download nilanjan-k/tempmailblocker 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/ */

    

nilanjan-k / tempmailblocker example snippets


use Illuminate\Foundation\Http\FormRequest;

class RegisterRequest extends FormRequest
{
    public function rules(): array
    {
        return [
            'email' => ['

use NilanjanK\TempMailBlocker\Rules\Indisposable;

$request->validate([
    'email' => ['

use NilanjanK\TempMailBlocker\Rules\Indisposable;

$request->validate([
    'email' => [
        '    ],
]);

use TempMailBlocker;

if (TempMailBlocker::isDisposable($email)) {
    // handle rejection
}

if (TempMailBlocker::isIndisposable($email)) {
    // proceed normally
}

use NilanjanK\TempMailBlocker\Facades\TempMailBlocker;

TempMailBlocker::isDisposable('[email protected]'); // true
TempMailBlocker::isIndisposable('[email protected]');    // true
TempMailBlocker::count();                             // e.g. 19 000+

use Illuminate\Support\Facades\Schedule;

Schedule::command('tempmailblocker:update')->daily();

protected function schedule(Schedule $schedule): void
{
    $schedule->command('tempmailblocker:update')->daily();
}

'whitelist' => [
    'my-internal-tool.com',
    'trusted-partner.org',
],

'blacklist' => [
    'new-sketchy-domain.io',
    'suspicious-provider.net',
],
bash
php artisan tempmailblocker:update
bash
php artisan vendor:publish --tag=tempmailblocker-config
bash
php artisan tempmailblocker:update