Download the PHP package oxemis/oxibounce without Composer
On this page you can find all versions of the php package oxemis/oxibounce. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package oxibounce
Official OxiBounce PHP Wrapper
Overview
This repository contains the official PHP wrapper for the OxiBounce API. To get started, create an account and request your free credits on this page
This library is a wrapper for the OxiBounce API but you don't have to know how to use the API to get started with this library.
What is OxiBounce ?
OxiBounce is an online service dedicated to the verification of emails addresses. It will not only validate that the address is valid but it will also check the existence of the email.
Table of contents
- Compatibility
- Installation
- Authentication
- Getting information about your account
- Checking an email the best way
- Asynchronous check
- Synchronous check
- What are the meaning of the EmailCheckResult properties ?
- Contribute / Need help ?
Compatibility
This library requires PHP v7.4 or higher.
Installation
Use the below code to install the wrapper:
composer require oxemis/oxibounce
Authentication
This library is a wrapper to the OxiBounce API. You can request an API KEY in your OxiBounce Account. Free credits are offered.
You should export your API_LOGIN and API_PASSWORD in order to use them in this library :
Initialize your OxiBounce Client:
Getting information about your account
You will find all the information about your OxiBounce account with the "UserAPI" object. Informations returned are documented in the class.
Checking an email the best way
OxiBounce allows you to check an email address with two methods :
- Asynchronously : this is the best method to get better results but it can take time to validate completly an address. Use this method for a background worker for instance.
- Synchronously : this is the method you should prefer if you want to validate emails on a form (for example). You will be able to specify a "timeout" after which the verification method will stop in order to not block users. The more time you let, the better the results will be.
The complete validation of an email address can take time !
More than 20 different tests are carried out, some of which depend on the performance of the mail servers of the addresses tested.
We always do our best to return the result as quickly as possible (within seconds), but sometimes the whole test can take several minutes!
If you are limited by time, use the "Synchronous" method with an appropriate timeout.
Asynchronous check
The async method will require you to :
- Start a test that will return you an ID
- Periodically, check this ID to check if the test is "PENDING" or "DONE"
Step 1 : run the test
Step 2 : get the status and results
Synchronous check
The synchronous method manage a limit of time for the checks.
Here is a simple sample :
What to do with "PENDING" checks (timeout reached) ?
Short answer : consider them as "NOT_SURE".
You can also store there "ID" (
$result->getId()) in order to get the results later with the$client->checkAPI->getCheckResultAsyncFromId()method.
What are the meaning of the EmailCheckResult properties ?
The EmailCheckResult structure contains a lot of informations about the test results.
Each one is documented as PHPDoc if you need to get a description in your IDE.
| Property | Meaning | |
|---|---|---|
| Result | The result of the test. Can be RESULT_OK, RESULT_KO or RESULT_NOTSURE. For more details, see “Reason”. | |
| Reason | The detailled reason of the result (many codes are availables, see page 2 of this document). | |
| Domain | The domain of the email. | |
| IsFormatValid | True if the email address has a valid format. | |
| IsDisposable | Indicates that the address is a disposable address. Disposable addresses can be dangerous because they are not necessarily associated with a single recipient (it is sometimes enough to know the address to consult its contents). Never send messages containing confidential information to such addresses. | |
| IsFreeMail | Indicates that the address is a “free” address, therefore not associated with a particular company. | |
| IsRisky | Indicates that the address or its domain is identified as potentially dangerous. It is strongly recommended not to send to these addresses to preserve your reputation. | |
| IsRobot | Indicates that the e-mail address appears to be associated with a robot and not with a real person or a department of a company. Behind some of these addresses are hidden spamtraps. So be very careful. | |
| IsRole | Indicates that the address is that of a department of a company or that it is a generic address (contact@…). | |
| MailSystem | Contains, if identified, the email system used by the owner of the email address. | |
| Suggestion | In case of an invalid address, OxiBounce will be able to suggest a correction (gmial.com at the link of gmail.com for example). To be used with caution and manual validation of course. |
Managing lists
In addition to the simple checks, you also have the ability to add a list of emails, start / stop the analysis of this list, get the results for the whole list and delete the list.
Here's a simple sample to upload a JSON list to OxiBounce :
Once uploaded, you'll get an EmailList Object with and Id that you can use to start (or stop with stopList) the list :
You can follow the processing of the list by refreshing the list object :
And then get the results (when DONE or CANCELED) :
You also have the ability to completly remove a list from our servers :
Contribute / Need help ?
Feel free to ask anything, and contribute to this project. Need help ? 👉 [email protected]