PHPackages                             mendel-ideo/freshmail-rest-api - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. mendel-ideo/freshmail-rest-api

ActiveLibrary[HTTP &amp; Networking](/categories/http)

mendel-ideo/freshmail-rest-api
==============================

A php library which implements the functionality of FreshMail REST API.

1.0.0(3y ago)040GPL-3.0PHPPHP &gt;=8.1

Since Mar 23Pushed 3y agoCompare

[ Source](https://github.com/mendel-ideo/FRESHMAIL-REST-API)[ Packagist](https://packagist.org/packages/mendel-ideo/freshmail-rest-api)[ RSS](/packages/mendel-ideo-freshmail-rest-api/feed)WikiDiscussions master Synced 1mo ago

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

FreshMail
=========

[](#freshmail)

A php library which implements connection to FreshMail REST API.

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

- subscribers management
- list management
- campaign management
- sending transactional SMS messages

If You want to send transactional messages in rich format please use new [API V3 client](https://github.com/FreshMail/php-api-client).

Installation via composer (compatible with PHP &gt;=7.0)
--------------------------------------------------------

[](#installation-via-composer-compatible-with-php-70)

Add via composer:

```
composer require freshmail/rest-api:^3.0

```

Installation of old version of library (compatible with PHP &gt;=5.3)
---------------------------------------------------------------------

[](#installation-of-old-version-of-library-compatible-with-php-53)

Add via composer:

```
composer require freshmail/rest-api:^2.0

```

Usage
-----

[](#usage)

Below some simple examples, for whole API function see [full API V2 doc](https://freshmail.pl/developer-api/jak-zaczac/)

#### Test connection

[](#test-connection)

```
use \FreshMail\ApiV2\Client;

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

$apiClient->doRequest('ping');

```

#### Create subscribers list

[](#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

[](#add-subscriber-to-list)

```
use \FreshMail\ApiV2\Client;

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

$data = [
    'email' => 'example@email.address',
    'list' => 'list_hash'
];

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

```

#### Get file from async api

[](#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
-----------

[](#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
---------

[](#debugging)

#### PSR-3 Logger Interface

[](#psr-3-logger-interface)

You can use any library that implements [PSR-3](https://www.php-fig.org/psr/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

[](#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);

```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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

Unknown

Total

1

Last Release

1147d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ce8970078ffd42ffe0d97d3023b5d0527895daa407730c6a92fd2b0753e21481?d=identicon)[m.mendel](/maintainers/m.mendel)

---

Top Contributors

[![grzesiekgorczyca](https://avatars.githubusercontent.com/u/8577651?v=4)](https://github.com/grzesiekgorczyca "grzesiekgorczyca (9 commits)")[![ankalagon](https://avatars.githubusercontent.com/u/532333?v=4)](https://github.com/ankalagon "ankalagon (5 commits)")[![mendel-ideo](https://avatars.githubusercontent.com/u/128601271?v=4)](https://github.com/mendel-ideo "mendel-ideo (4 commits)")[![FreshMailAPP](https://avatars.githubusercontent.com/u/8984733?v=4)](https://github.com/FreshMailAPP "FreshMailAPP (1 commits)")[![fugi](https://avatars.githubusercontent.com/u/4803401?v=4)](https://github.com/fugi "fugi (1 commits)")

---

Tags

restfreshmail

### Embed Badge

![Health badge](/badges/mendel-ideo-freshmail-rest-api/health.svg)

```
[![Health](https://phpackages.com/badges/mendel-ideo-freshmail-rest-api/health.svg)](https://phpackages.com/packages/mendel-ideo-freshmail-rest-api)
```

###  Alternatives

[zircote/swagger-php

Generate interactive documentation for your RESTful API using PHP attributes (preferred) or PHPDoc annotations

5.3k132.9M468](/packages/zircote-swagger-php)[nelmio/api-doc-bundle

Generates documentation for your REST API from attributes

2.3k63.6M233](/packages/nelmio-api-doc-bundle)[pusher/pusher-php-server

Library for interacting with the Pusher REST API

1.5k94.8M293](/packages/pusher-pusher-php-server)[shopify/shopify-api

Shopify API Library for PHP

4634.8M16](/packages/shopify-shopify-api)[eightpoints/guzzle-bundle

Integrates Guzzle 6.x, a PHP HTTP Client, into Symfony. Comes with easy and powerful configuration options and optional plugins.

45912.1M55](/packages/eightpoints-guzzle-bundle)[omniphx/forrest

A Laravel library for Salesforce

2724.4M8](/packages/omniphx-forrest)

PHPackages © 2026

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