PHPackages                             dmt-software/laposta-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. [API Development](/categories/api)
4. /
5. dmt-software/laposta-api

ActiveLibrary[API Development](/categories/api)

dmt-software/laposta-api
========================

Client to consume the Laposta API

0.4.1(4w ago)012.7k↓62.1%[1 issues](https://github.com/dmt-software/laposta-api/issues)MITPHPPHP &gt;=8.3

Since Apr 12Pushed 2w ago1 watchersCompare

[ Source](https://github.com/dmt-software/laposta-api)[ Packagist](https://packagist.org/packages/dmt-software/laposta-api)[ RSS](/packages/dmt-software-laposta-api/feed)WikiDiscussions main Synced yesterday

READMEChangelog (10)Dependencies (22)Versions (14)Used By (0)

Laposta API
===========

[](#laposta-api)

An Object-Oriented client to consume the Laposta API.

Install
-------

[](#install)

```
composer require dmt-software/laposta-api
```

### Configure

[](#configure)

After installing this package you need to configure it. The quickest way to do this is simply add a config file and use it to load the config into a `Config` instance.

```
// file: config.php

return [
    'apiKey' => 'JdMtbsMq2jqJdQZD9AHC',
    'customFieldsClasses' => [],
    'httpClient' => \GuzzleHttp\Client::class,
    'requestFactory' => \GuzzleHttp\Psr7\HttpFactory::class,
];
```

### Generate entity

[](#generate-entity)

The next step is to generate an entity for the custom fields for the mailing list(s).

```
vendor/bin/laposta generate:list-fields config.php -l BaImMu3JZA
```

More in depth information about the custom fields can be found in the subscribers [documentation](/docs/subscribers.md).

Usage
-----

[](#usage)

### Initiate a Client

[](#initiate-a-client)

The easiest way to create a client instance is using the factories in this package. These factories can also be used (as guideline) in a dependency injection container.

```
use DMT\Laposta\Api\Clients\Subscribers;
use DMT\Laposta\Api\Config;
use DMT\Laposta\Api\Factories\CommandBusFactory;

$commandBus = CommandBusFactory::create(Config::load('config.php'));

$client = new Subscribers($commandBus);
```

### Subscribe a user to a mailing list

[](#subscribe-a-user-to-a-mailing-list)

```
use DMT\CommandBus\Validator\ValidationException;
use DMT\Laposta\Api\Entity\BaseCustomFields;
use DMT\Laposta\Api\Entity\Subscriber;
use DMT\Laposta\Api\Clients\Subscribers;
use Psr\Http\Client\ClientExceptionInterface;

try {
    /** @var BaseCustomFields $customFields The generated entity for your list */

    $subscriber = new Subscriber();
    $subscriber->listId = 'BaImMu3JZA';
    $subscriber->email = 'user@example.com';
    $subscriber->customFields = $customFields;
    $subscriber->customFields->name = 'John Do';

    /** @var Subscribers $client */
    $client->create($subscriber, Subscribers::OPTION_SUPPRESS_EMAIL_NOTIFICATION);
} catch (ValidationException $exception) {
     // input was wrong
} catch (ClientExceptionInterface $exception) {
    // error response
}
```

More on how to use this package can be found in the client [documentation](/docs/clients.md).

###  Health Score

50

—

FairBetter than 95% of packages

Maintenance96

Actively maintained with recent releases

Popularity25

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 97.2% of commits — single point of failure

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

Every ~95 days

Recently: every ~160 days

Total

13

Last Release

29d ago

PHP version history (2 changes)0.1.0PHP &gt;=7.4

0.4.0PHP &gt;=8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/ec6b7fbb4d231b5c2c76348cf3a13ec5e82c64a1826142f6ec0db1cf15db2873?d=identicon)[proggeler](/maintainers/proggeler)

---

Top Contributors

[![proggeler](https://avatars.githubusercontent.com/u/18281353?v=4)](https://github.com/proggeler "proggeler (69 commits)")[![KirosML](https://avatars.githubusercontent.com/u/123894927?v=4)](https://github.com/KirosML "KirosML (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/dmt-software-laposta-api/health.svg)

```
[![Health](https://phpackages.com/badges/dmt-software-laposta-api/health.svg)](https://phpackages.com/packages/dmt-software-laposta-api)
```

###  Alternatives

[guzzlehttp/psr7

PSR-7 message implementation that also provides common utility methods

8.0k1.1B4.0k](/packages/guzzlehttp-psr7)[flow-php/flow

PHP ETL - Extract Transform Load - Data processing framework

85036.3k](/packages/flow-php-flow)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k5.9M736](/packages/sylius-sylius)[shopware/platform

The Shopware e-commerce core

3.4k1.5M3](/packages/shopware-platform)[tempest/framework

The PHP framework that gets out of your way.

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

Shopware platform is the core for all Shopware ecommerce products.

585.6M574](/packages/shopware-core)

PHPackages © 2026

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