exs / bulk-email-checker-bundle
This bundle provides an email validation through 'Bulk Email Checker' api.
Installs: 6 654
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 10
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=7.2
- symfony/framework-bundle: ~3.4
- symfony/validator: ~3.4
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.15
- phpstan/phpstan: ^0.11.12
- phpunit/phpunit: ^8.3
This package is auto-updated.
Last update: 2025-01-05 01:35:34 UTC
README
Installation
Download the bundle using composer
$ composer require exs/bulk-email-checker-bundle
Enable the bundle
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new EXS\BulkEmailCheckerBundle\EXSBulkEmailCheckerBundle(), // ... ); }
Configuration
Minimum required configuration
exs_bulk_email_checker: api_key: 'YourApiKey'
Complete configuration (default values shown)
exs_bulk_email_checker: enabled: true pass_on_error: true check_mx: false api_key: 'YourApiKey' api_url: 'https://api-v4.bulkemailchecker.com/?key=#api_key#&email=#email#' whitelisted_domains: ['mycompany.tld'] blacklisted_domains: ['thebadguyscompany.tld']
Usage
Use the "BulkEmailChecker" constraint.
<?php // On any entity or model class. use EXS\BulkEmailCheckerBundle\Validator\Constraints as ExsAssert; // ... class SomeClass { // ... /** * @var string * * @ExsAssert\BulkEmailChecker() */ private $email; // ... }
You can also use directly the service called "exs_bulk_email_checker.bulk_email_checker_manager" and it's "validate()" method.
// Dummy example $email = 'foo@bar.baz'; $manager = $this->container->get('exs_bulk_email_checker.bulk_email_checker_manager'); $valid = $manager->validate($email); // boolean value