Download the PHP package innovato/mailjet-apiv3-php without Composer

On this page you can find all versions of the php package innovato/mailjet-apiv3-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package mailjet-apiv3-php

alt text

Official Mailjet PHP Wrapper

Codacy Badge Build Status MIT License Current Version

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.

Table of contents

Compatibility

This library requires PHP v5.4 or higher.

Installation

Use the below code to install the wrapper:

composer require mailjet/mailjet-apiv3-php

If you are not using Composer, clone or download this repository 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

The Mailjet Email API uses your API and Secret keys for authentication. Grab and save your Mailjet API credentials.

Note: For the SMS API the authorization is based on a Bearer token. See information about it in the SMS API section of the readme.

Initialize your Mailjet Client:

Make your first call

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

Client / Call Configuration Specifics

To instantiate the library you can use the following constructor:

new \Mailjet\Client($MJ_APIKEY_PUBLIC, $MJ_APIKEY_PRIVATE,$CALL,$OPTIONS);

Options

API Versioning

The Mailjet API is spread among three distinct versions:

Since most Email API endpoints are located under v3, it is set as the default one and does not need to be specified when making your request. For the others you need to specify the version using version. For example, if using Send API v3.1:

For additional information refer to our API Reference.

Base URL

The default base domain name for the Mailjet API is api.mailjet.com. You can modify this base URL by setting a value for url in your call:

If your account has been moved to Mailjet's US architecture, the URL value you need to set is api.us.mailjet.com.

Disable API call

By default the API call parameter is always enabled. However, you may want to disable it during testing to prevent unnecessary calls to the Mailjet API. This is done by setting the call parameter to false:

List of resources

You can find the list of all available resources for this library in /src/Mailjet/Resources.php. The file lists the names of the PHP resources and the corresponding names in the API reference.

Request Examples

POST Request

Use the post method of the Mailjet CLient (i.e. $mj->post($resource, $params))

$params will be a PHP associative array with the following keys :

Simple POST request

Using actions

GET Request

Use the get method of the Mailjet CLient (i.e. $mj->get($ressource, $params))

$param will be a PHP associative array with the following keys :

Retrieve all objects

Use filtering

Retrieve a single object

PUT Request

Use the put method of the Mailjet CLient (i.e. $mj->put($ressource, $params))

$param will be a PHP associative array with the following keys :

A PUT request in the Mailjet API will work as a PATCH request - the update will affect only the specified properties. The other properties of an existing resource will neither be modified, nor deleted. It also means that all non-mandatory properties can be omitted from your payload.

Here's an example of a PUT request:

DELETE Request

Use the delete method of the Mailjet CLient (i.e. $mj->delete($ressource, $params))

Upon a successful DELETE request the response will not include a response body, but only a 204 No Content response code.

Here's an example of a DELETE request:

Response

The get, post, put and delete method will return a Response object with the following available methods:

API resources helpers

All API resources are listed in the Resources object. It will make it easy to find the resources and actions aliases.

SMS API

Token Authentication

Authentication for the SMS API endpoints is done using a bearer token. The bearer token is generated in the SMS section of your Mailjet account.

To create a new instance of the Mailjet client with token authentication, the token should be provided as the first parameter, and the second must be NULL:

Example Request

Here's an example SMS API request:

Contribute

Mailjet loves developers. You can be part of this project!

This wrapper is a great introduction to the open source world, check out the code!

Feel free to ask anything, and contribute:

If you have suggestions on how to improve the guides, please submit an issue in our Official API Documentation repo.


All versions of mailjet-apiv3-php with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
guzzlehttp/guzzle Version ~6.0|~5.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package innovato/mailjet-apiv3-php contains the following files

Loading the files please wait ....