Download the PHP package mendel-ideo/freshmail-rest-api without Composer

On this page you can find all versions of the php package mendel-ideo/freshmail-rest-api. 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 freshmail-rest-api

FreshMail

A php library which implements connection to FreshMail REST API.

This API client covers all functions of API V2 such as:

If You want to send transactional messages in rich format please use new API V3 client.

Installation via composer (compatible with PHP >=7.0)

Add via composer:

composer require freshmail/rest-api:^3.0

Installation of old version of library (compatible with PHP >=5.3)

Add via composer:

composer require freshmail/rest-api:^2.0

Usage

Below some simple examples, for whole API function see full API V2 doc

Test connection

use \FreshMail\ApiV2\Client;

$token = 'MY_APP_TOKEN';
$apiClient = new Client($token);

$apiClient->doRequest('ping');

Create subscribers list

use \FreshMail\ApiV2\Client;

$token = 'MY_APP_TOKEN';
$apiClient = new Client($token);

$data = [
    'name' => 'List with subscribers from my website'
];

$apiClient->doRequest('subscribers_list/create', $data);

Add subscriber to list

use \FreshMail\ApiV2\Client;

$token = 'MY_APP_TOKEN';
$apiClient = new Client($token);

$data = [
    'email' => '[email protected]',
    'list' => 'list_hash'
];

$apiClient->doRequest('subscriber/add', $data);

Get file from async api

use \FreshMail\ApiV2\Client;

$token = 'MY_APP_TOKEN';
$apiClient = new Client($token);

$data = [
    'id_job' => 'XXX'
];

$zipContent = $apiClient->doFileRequest('async_result/getFile', $data);

file_put_contents('/testLocation/testfile.zip', $zipContent);

Proxy setup

To use proxy You can pass Your own GuzzleHttp Client:

use \FreshMail\ApiV2\Client;

$guzzleClient = new \GuzzleHttp\Client(
    [
        'proxy' => 'my proxy url'
    ]
);

$token = 'MY_APP_TOKEN';
$apiClient = new Client($token);
$apiClient->setGuzzleHttpClient($guzzleClient);

Debugging

PSR-3 Logger Interface

You can use any library that implements PSR-3 Psr\Log\LoggerInterface, example with Monolog below:

use \FreshMail\ApiV2\Client;  

$logger = new \Monolog\Logger('myCustomLogger');
$logger->pushHandler(new \Monolog\Handler\StreamHandler('php://stderr', \Monolog\Logger::DEBUG));

$token = 'MY_APP_TOKEN';
$apiClient = new Client($token);
$apiClient->setLogger($monolog);

Using Guzzle

You can also pass Your own GuzzleHttp Client with proper configuration:

use \FreshMail\ApiV2\Client;

$stack = \GuzzleHttp\HandlerStack::create();
$stack->push(
    \GuzzleHttp\Middleware::log(
        new \Monolog\Logger('Logger'),
        new \GuzzleHttp\MessageFormatter(\GuzzleHttp\MessageFormatter::DEBUG)
    )
);

$guzzleClient = new \GuzzleHttp\Client(
    [
        'handler' => $stack,
    ]
);

$token = 'MY_APP_TOKEN';
$apiClient = new Client($token);
$apiClient->setGuzzleHttpClient($guzzleClient);

All versions of freshmail-rest-api with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
ext-curl Version *
ext-json Version *
monolog/monolog Version ^3.0
guzzlehttp/guzzle Version ~7.2
psr/log Version ^2.0 || ^3.0
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 mendel-ideo/freshmail-rest-api contains the following files

Loading the files please wait ....