exs/bulk-email-checker-bundle
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(),
// ...
);
}
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']
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 = '[email protected]';
$manager = $this->container->get('exs_bulk_email_checker.bulk_email_checker_manager');
$valid = $manager->validate($email); // boolean value
How can I help you explore Laravel packages today?