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 2d 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 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity54

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

1200d 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

[laravel/framework

The Laravel Framework.

34.8k543.8M20.1k](/packages/laravel-framework)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k38.9k](/packages/matomo-matomo)[craftcms/cms

Craft CMS

3.6k3.6M3.1k](/packages/craftcms-cms)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M577](/packages/shopware-core)[elgg/elgg

Elgg is an award-winning social networking engine, delivering the building blocks that enable businesses, schools, universities and associations to create their own fully-featured social networks and applications.

1.7k16.4k79](/packages/elgg-elgg)

PHPackages © 2026

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