PHPackages                             innovato/mailjet-apiv3-php - 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. [Mail &amp; Notifications](/categories/mail)
4. /
5. innovato/mailjet-apiv3-php

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

innovato/mailjet-apiv3-php
==========================

PHP wrapper for the Mailjet API

v1.4.1(7y ago)019MITPHPPHP &gt;=5.4.0

Since May 22Pushed 5y agoCompare

[ Source](https://github.com/innovato/mailjet-apiv3-php)[ Packagist](https://packagist.org/packages/innovato/mailjet-apiv3-php)[ Docs](https://github.com/mailjet/mailjet-apiv3-php/)[ RSS](/packages/innovato-mailjet-apiv3-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (38)Used By (0)

[![alt text](https://camo.githubusercontent.com/e0ba8a283113ae3c7f2ef84660c832c21b3928d15d14981a39352addc123845f/68747470733a2f2f7777772e6d61696c6a65742e636f6d2f696d616765732f656d61696c2f7472616e7361632f6c6f676f5f6865616465722e706e67 "Mailjet")](https://camo.githubusercontent.com/e0ba8a283113ae3c7f2ef84660c832c21b3928d15d14981a39352addc123845f/68747470733a2f2f7777772e6d61696c6a65742e636f6d2f696d616765732f656d61696c2f7472616e7361632f6c6f676f5f6865616465722e706e67)

Official Mailjet PHP Wrapper
============================

[](#official-mailjet-php-wrapper)

[![Codacy Badge](https://camo.githubusercontent.com/f9d25ce2f8a5c4243970ab699022644a009a7fb64183c4cd62f09c8f7ff56ff0/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f67726164652f3366613732396633373530383439636538653034373162303438373433396362)](https://www.codacy.com/app/gbadi/mailjet-apiv3-php)[![Build Status](https://camo.githubusercontent.com/09193bfea5158cbf116031666ec9b9961137635d97fa34ec77828d6083452026/68747470733a2f2f7472617669732d63692e6f72672f6d61696c6a65742f6d61696c6a65742d61706976332d7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/mailjet/mailjet-apiv3-php)[![MIT License](https://camo.githubusercontent.com/48593de0035d3aebc555d81be22bb1136d0741866cc69614fd437cacc7553cf7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d3030374543372e7376673f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/48593de0035d3aebc555d81be22bb1136d0741866cc69614fd437cacc7553cf7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d3030374543372e7376673f7374796c653d666c61742d737175617265)[![Current Version](https://camo.githubusercontent.com/e720ad356e9267a5311c68585ea579f4d2d4f4c9c2f65f0b6513e6fad6eae7df/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76657273696f6e2d312e342e312d677265656e2e737667)](https://camo.githubusercontent.com/e720ad356e9267a5311c68585ea579f4d2d4f4c9c2f65f0b6513e6fad6eae7df/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76657273696f6e2d312e342e312d677265656e2e737667)

Overview
--------

[](#overview)

This repository contains the official PHP wrapper for the Mailjet API.

Check out all the resources and PHP code examples in the [Offical Documentation](https://dev.mailjet.com/guides/?php#getting-started).

Table of contents
-----------------

[](#table-of-contents)

- [Compatibility](#compatibility)
- [Installation](#installation)
- [Authentication](#authentication)
- [Make your first call](#make-your-first-call)
- [Client / Call configuration specifics](#client--call-configuration-specifics)
    - [Options](#options)
        - [API versioning](#api-versioning)
        - [Base URL](#base-url)
    - [Disable API call](#disable-api-call)
- [List of resources](#list-of-resources)
- [Request examples](#request-examples)
    - [POST request](#post-request)
        - [Simple POST request](#simple-post-request)
        - [Using actions](#using-actions)
    - [GET request](#get-request)
        - [Retrieve all objects](#retrieve-all-objects)
        - [Use filtering](#use-filtering)
        - [Retrieve a single object](#retrieve-a-single-object)
    - [PUT request](#put-request)
    - [DELETE request](#delete-request)
    - [Response](#response)
    - [API resources helpers](#api-resources-helpers)
- [SMS API](#sms-api)
    - [Token authentication](#token-authentication)
    - [Example Request](#example-request)
- [Contribute](#contribute)

### Compatibility

[](#compatibility)

This library requires **PHP v5.4** or higher.

### Installation

[](#installation)

Use the below code to install the wrapper:

`composer require mailjet/mailjet-apiv3-php`

If you are not using [Composer](https://getcomposer.org/), clone or download [this repository](https://github.com/mailjet/mailjet-apiv3-php-no-composer) that already contains all the dependencies and the `vendor/autoload.php` file. If you encounter an issue, please post it here and not on the mirror repository.

### Authentication

[](#authentication)

The Mailjet Email API uses your API and Secret keys for authentication. [Grab](https://app.mailjet.com/account/api_keys) and save your Mailjet API credentials.

```
export MJ_APIKEY_PUBLIC='your API key'
export MJ_APIKEY_PRIVATE='your API secret'
```

> Note: For the SMS API the authorization is based on a Bearer token. See information about it in the [SMS API](#sms-api) section of the readme.

Initialize your [Mailjet](http://www.mailjet.com) Client:

```
use \Mailjet\Resources;

// getenv will allow us to get the MJ_APIKEY_PUBLIC/PRIVATE variables we created before:

$apikey = getenv('MJ_APIKEY_PUBLIC');
$apisecret = getenv('MJ_APIKEY_PRIVATE');

$mj = new \Mailjet\Client($apikey, $apisecret);

// or, without using environment variables:

$apikey = 'your API key';
$apisecret = 'your API secret';

$mj = new \Mailjet\Client($apikey, $apisecret);
```

### Make your first call

[](#make-your-first-call)

Here's an example on how to send an email:

```
