romanzipp / laravel-validator-pizza
A Laravel Wrapper for the laravel.pizza disposable email API
Fund package maintenance!
romanzipp
Installs: 27 243
Dependents: 0
Suggesters: 0
Security: 0
Stars: 19
Watchers: 2
Forks: 4
Open Issues: 0
Requires
- php: ^7.2|^8.0
- guzzlehttp/guzzle: ^6.3|^7.0
- illuminate/support: ^5.5|^6.0|^7.0|^8.0|^9.0|^10.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- mockery/mockery: ^1.3.2
- orchestra/testbench: >=3.8
- phpstan/phpstan: ^0.12.99|^1.0
- phpunit/phpunit: ^8.0|^9.0
- romanzipp/php-cs-fixer-config: ^3.0
README
⚠️ This package has been renamed
You can find the new project at romanzipp/Laravel-MailCheck. This repository will not get any updates anymore.
Laravel Validator.Pizza
A Laravel Wrapper for the Validator.pizza disposable email API made by @tompec.
Features
- Query the Validator.Pizza API for disposable Emails & Domains
- Cache responses
- Store requested domains in database
Installation
composer require romanzipp/laravel-validator-pizza
Configuration
Copy configuration to your project:
php artisan vendor:publish --provider="romanzipp\ValidatorPizza\Providers\ValidatorPizzaProvider"
Run the migration:
php artisan migrate
Change the config to your desired settings:
return [ // Database storage enabled 'store_checks' => true, // Database table name 'checks_table' => 'validator_pizza', // Cache enabled (recommended) 'cache_checks' => true, // Duration in minutes to keep the query in cache 'cache_duration' => 30, // Determine which decision should be given if the rate limit is exceeded [allow / deny] 'decision_rate_limit' => 'allow', // Determine which decision should be given if the domain has no MX DNS record [allow / deny] 'decision_no_mx' => 'allow', // Makes use of the API key 'key' => env('VALIDATOR_PIZZA_KEY'), ];
Usage
Controller Validation
namespace App\Http\Controllers; use Illuminate\Http\Request; class HomeController extends Controller { public function handleEmail(Request $request) { $request->validate([ 'email' => 'required|email|disposable_pizza', ]); // ... } }
Standalone
$checker = new \romanzipp\ValidatorPizza\Checker; // Validate Email $validEmail = $checker->allowedEmail('ich@ich.wtf'); // Validate Domain $validDomain = $checker->allowedDomain('ich.wtf');