PHPackages                             xylis/mailboxlayer-client - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. xylis/mailboxlayer-client

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

xylis/mailboxlayer-client
=========================

MailboxLayer API Client for validating emails

1.0.1(6y ago)17GPL-3.0-or-laterPHPPHP ^7.1

Since Aug 4Pushed 6y ago1 watchersCompare

[ Source](https://github.com/JulienRAVIA/MailboxLayerClient)[ Packagist](https://packagist.org/packages/xylis/mailboxlayer-client)[ Docs](https://github.com/JulienRAVIA/MailboxLayerClient)[ RSS](/packages/xylis-mailboxlayer-client/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (5)Versions (3)Used By (0)

MailboxLayerClient
==================

[](#mailboxlayerclient)

[![Latest Version on Packagist](https://camo.githubusercontent.com/4d8b2d8cf34f772d07df3716e49e8ba08d883f8b5fa821e73c06829962862ddc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f78796c69732f6d61696c626f786c617965722d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/xylis/mailboxlayer-client)[![Software License](https://camo.githubusercontent.com/e1514dd3f2095dbf68a0008ae62a631142953ad2e86aa94c504343f2c2c191da/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d47504c2d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/43650540816499a836124671b96b8d9fc7f59621a8656a543c8a0f917e5a764e/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f4a756c69656e52415649412f4d61696c626f784c61796572436c69656e742f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/JulienRAVIA/MailboxLayerClient)[![Total Downloads](https://camo.githubusercontent.com/499b4ab3b8e952dfc72f7c9b2ef5894708d99e8b96550e640e1d2615965339fe/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f78796c69732f6d61696c626f786c617965722d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/xylis/mailboxlayer-client)

This library is a PHP client for [MailboxLayer](https://mailboxlayer.com), it's useful to validate if a email address provided by a user is valid, exists or to have some useful informations about an email address.

Structure
---------

[](#structure)

```
src/
tests/
vendor/

```

Install
-------

[](#install)

**This package requires PHP &gt;= 7.1.**

Via Composer

```
$ composer require xylis/mailboxlayer-client
```

Basic Usage
-----------

[](#basic-usage)

```
$client = new Xylis\MailboxLayer\Client('YOUR_API_KEY');

// Check if the email is valid
$client->validate('email@ddress.com')->isValid();
```

Documentation
-------------

[](#documentation)

### Client constructor

[](#client-constructor)

```
$client = new Xylis\MailboxLayer\Client(string $apiKey, bool $smtpCheck = true, bool $prettyFormat = false, bool $catchAllCheck = false)
```

- If you put $smtpCheck to *false* (*true* by default), the api won't check if email address exist
- If you put $prettyFormat to *true* (*false* by default), the api will return prettified JSON result (use only for debugging)
- If you put $catchAllCheck to *true* (*false* by default), the api will check if the addresses you check are catch-all mailboxes.

Please do read the [MailboxLayer Documentation](https://mailboxlayer.com/documentation) to understand how their API works.

---

`validate(string $email)` returns an email object so you can do this way :

```
$email = $client->validate('email@address.com');

// Check if the email is valid
$email->isFormatValid();

// Check if the email format is valid
$email->isFormatValid();

// Check if the email format is valid
$email->isMxFound();

// Check if email address exists, return false if not
$email->isSmtpValid();

// Get the email address (return email@ddress.com)
$email->getMail();

// Get the user from email address (return email)
$email->getUser();

// Get the domain from email address (return ddress.com)
$email->getDomain();

// Get suggestion if the email address is misspelled
$email->getSuggestion();

// Get quality score between 0 (bad) and 1 (good)
$email->getQualityScore();

// Check if email address is free delivered (domains like gmail.com and yahoo.com)
$email->isFreeDeliveredEmailAddress();

// Check if email address is disposable (trash & temporary mailbox)
$email->isDisposable();

// Check if email address is a role mail address (like support)
$email->isRoleEmailAddress();
```

How the `validate` function works :

```
$client->validate(string $emailAddress, bool $bypassFilterValidation = false);
```

If `$bypassFilterValidation` is set to *true* (*false* by default), the client won't verify if `$emailAddress` himself is an email, so the client will make the API request to the API anyway. `$bypassFilterValidation` is set to *false* gain in performance and avoid useless results

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CODE\_OF\_CONDUCT](CODE_OF_CONDUCT.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email [Julien RAVIA](mailto:julien.ravia@gmail.com) instead of using the issue tracker.

Credits
-------

[](#credits)

- [Julien RAVIA](https://github.com/JulienRAVIA)
- [All Contributors](../../contributors)

License Information
-------------------

[](#license-information)

- GNU GPL v3
- You can find a copy of this software here:

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

2469d ago

PHP version history (2 changes)1.0PHP ~7.1

1.0.1PHP ^7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/b027db90d3beb1d155d69186f6a7215547120e3ab5dd74a0c445edbee3953b41?d=identicon)[Xylis](/maintainers/Xylis)

---

Top Contributors

[![JulienRAVIA](https://avatars.githubusercontent.com/u/8202241?v=4)](https://github.com/JulienRAVIA "JulienRAVIA (12 commits)")

---

Tags

validatorapi clientmailboxlayerxylis

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/xylis-mailboxlayer-client/health.svg)

```
[![Health](https://phpackages.com/badges/xylis-mailboxlayer-client/health.svg)](https://phpackages.com/packages/xylis-mailboxlayer-client)
```

###  Alternatives

[respect/validation

The most awesome validation engine ever created for PHP

5.9k37.4M379](/packages/respect-validation)[seld/jsonlint

JSON Linter

1.3k217.8M206](/packages/seld-jsonlint)[composer/spdx-licenses

SPDX licenses list and validation library.

1.4k184.2M25](/packages/composer-spdx-licenses)[opis/json-schema

Json Schema Validator for PHP

64236.9M184](/packages/opis-json-schema)[intervention/validation

Additional validation rules for the Laravel framework

6826.7M8](/packages/intervention-validation)[laminas/laminas-validator

Validation classes for a wide range of domains, and the ability to chain validators to create complex validation criteria

15544.9M188](/packages/laminas-laminas-validator)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
