ylly/mailboxlayer

PHP Library for mailboxLayer by apiLayer

1.0.1 2019-02-13 09:19 UTC

This package is auto-updated.

Last update: 2024-05-13 20:55:24 UTC


README

This library allows you to easily implement mailboxLayer by apiLayer into your project.

Build Status

Require :

  • PHP 5.4+
  • PHP JSON

Limitations :

  • catch_all attribute is of no use with free mailboxLayer account.

see https://mailboxlayer.com/documentation#catch_all

Installation :

composer require ylly/mailboxLayer

Usage :

You need to generate a key on mailboxLayer and add it to the configuration.yml

see https://mailboxlayer.com/product

Configuration file :

accessKey: generated access key from mailboxLayer 

Check an email

The EmailChecker manage verifications on email addresses

You can set emailChecker with variables

$emailChecker = EmailCheckerFactory::create($accessKey, $proxy);

You can check set emailChecker from a YAML config file by

$emailChecker = EmailCheckerFactory::createFromYamlFile('/path/to/config.yml');

Or from an key-value array of configuration

$emailChecker = EmailCheckerFactory::createFromArray($configArray);

Fill user's email (and catch_all)

The users email addresses creates url for verifications

$check = $emailChecker->checkEmail($email);

or with catch_all boolean attributes

$check = $emailChecker->checkEmail($email, $catchAll);

Advanced usage :

A Log interface is provided to manage outputed logs, you can register your listener on the emailChecker

class Listener implement LogListenerInterface
{
    public function recieve($level, $message)
    {
        // do something
    }
}

$emailChecker->addListener(new Listener());