PHPackages                             postivo/postivo-client - 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. postivo/postivo-client

ActiveLibrary[API Development](/categories/api)

postivo/postivo-client
======================

v0.1.0(6mo ago)00MITPHPPHP &gt;=8.2

Since Oct 15Pushed 6mo agoCompare

[ Source](https://github.com/postivo/php-client)[ Packagist](https://packagist.org/packages/postivo/postivo-client)[ RSS](/packages/postivo-postivo-client/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (10)Versions (4)Used By (0)

[![Packagist Version](https://camo.githubusercontent.com/ebf84785e1cb29aec146fce13e103ce94a64ab8d1671aa736a75a4fdb2205d0d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f706f737469766f2f706f737469766f2d636c69656e74)](https://packagist.org/packages/postivo/postivo-client)[![GitHub License](https://camo.githubusercontent.com/f51c0eaf02d7926a1ff11f27049ba611fa6b1ef92719d8a9066f40f29e72f27d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f706f737469766f2f7068702d636c69656e74)](https://github.com/postivo/php-client/blob/main/LICENSE)[![Static Badge](https://camo.githubusercontent.com/f20375bebe19b99deaa71ef853e5ad67634ed5e161d45df58e3349bd50af9d5a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6275696c745f62792d537065616b656173792d79656c6c6f77)](https://www.speakeasy.com/?utm_source=postivo&utm_campaign=php)

POSTIVO.PL REST API Client SDK for PHP ≥ 8.2 (postivo/postivo-client)
=====================================================================

[](#postivopl-rest-api-client-sdk-for-php--82-postivopostivo-client)

This package provides the **POSTIVO.PL Hybrid Mail Services SDK** for PHP (≥ 8.2), allowing you to dispatch shipments directly from your application via the [POSTIVO.PL](https://postivo.pl) platform.

Additional documentation:
-------------------------

[](#additional-documentation)

Comprehensive documentation of all methods and types is available below in [Available Resources and Operations](#available-resources-and-operations).

You can also refer to the [REST API v1 documentation](https://api.postivo.pl/rest/v1/) for additional details about this SDK.

Table of Contents
-----------------

[](#table-of-contents)

- [POSTIVO.PL REST API Client SDK for PHP ≥ 8.2 (postivo/postivo-client)](#postivopl-rest-api-client-sdk-for-php-82-postivopostivo-client)
    - [Additional documentation:](#additional-documentation)
    - [SDK Installation](#sdk-installation)
    - [Requirements:](#requirements)
    - [SDK Example Usage](#sdk-example-usage)
    - [Authentication](#authentication)
    - [Available Resources and Operations](#available-resources-and-operations)
    - [Retries](#retries)
    - [Error Handling](#error-handling)
    - [Server Selection](#server-selection)
- [Development](#development)
    - [Maturity](#maturity)
    - [Contributions](#contributions)

SDK Installation
----------------

[](#sdk-installation)

The SDK relies on [Composer](https://getcomposer.org/) to manage its dependencies.

To install the SDK and add it as a dependency to an existing `composer.json` file:

```
composer require "postivo/postivo-client"
```

Requirements:
-------------

[](#requirements)

- Minimal required PHP version: 8.2

SDK Example Usage
-----------------

[](#sdk-example-usage)

### Sending Shipment to single recipient

[](#sending-shipment-to-single-recipient)

This example demonstrates simple sending Shipment to a single recipient:

```
declare(strict_types=1);

require 'vendor/autoload.php';

use Brick\DateTime\LocalDate;
use Postivo;
use Postivo\Models\Components;

$sdk = Postivo\Client::builder()
    ->setSecurity(
        ''
    )
    ->build();

$request = new Components\Shipment(
    recipients: new Components\RecipientInline(
        name: 'Jan Nowak',
        name2: 'Firma testowa Sp. z o.o.',
        address: 'ul. Testowa',
        homeNumber: '23',
        flatNumber: '2',
        postCode: '00-999',
        city: 'Warszawa',
        phoneNumber: '+48666666666',
        postscript: 'Komunikat',
        customId: '1234567890',
    ),
    documents: [
        new Components\DocumentPdf(
            fileStream: '',
            fileName: 'document1.pdf',
        ),
        new Components\DocumentPdf(
            fileStream: '',
            fileName: 'document2.pdf',
        ),
    ],
    options: new Components\ShipmentOptions(
        predefinedConfigId: 2670,
    ),
);

$response = $sdk->shipments->dispatch(
    request: $request
);

if ($response->shipmentDetails !== null) {
    // handle response
}
```

### Checking the price of a shipment for single recipient

[](#checking-the-price-of-a-shipment-for-single-recipient)

This example demonstrates simple checking the price of a Shipment to a single recipient:

```
declare(strict_types=1);

require 'vendor/autoload.php';

use Brick\DateTime\LocalDate;
use Postivo;
use Postivo\Models\Components;

$sdk = Postivo\Client::builder()
    ->setSecurity(
        ''
    )
    ->build();

$request = new Components\Shipment(
    recipients: new Components\RecipientInline(
        name: 'Jan Nowak',
        name2: 'Firma testowa Sp. z o.o.',
        address: 'ul. Testowa',
        homeNumber: '23',
        flatNumber: '2',
        postCode: '00-999',
        city: 'Warszawa',
        phoneNumber: '+48666666666',
        postscript: 'Komunikat',
        customId: '1234567890',
    ),
    documents: [
        new Components\DocumentPdf(
            fileStream: '',
            fileName: 'document1.pdf',
        ),
        new Components\DocumentPdf(
            fileStream: '',
            fileName: 'document2.pdf',
        ),
    ],
    options: new Components\ShipmentOptions(
        predefinedConfigId: 2670,
    ),
);

$response = $sdk->shipments->price(
    request: $request
);

if ($response->shipmentPrices !== null) {
    // handle response
}
```

Authentication
--------------

[](#authentication)

### Per-Client Security Schemes

[](#per-client-security-schemes)

This SDK supports the following security scheme globally:

NameTypeScheme`bearer`httpHTTP BearerTo authenticate with the API the `bearer` parameter must be set when initializing the SDK. For example:

```
declare(strict_types=1);

require 'vendor/autoload.php';

use Postivo;

$sdk = Postivo\Client::builder()
    ->setSecurity(
        ''
    )
    ->build();

$response = $sdk->accounts->get(

);

if ($response->accountResponse !== null) {
    // handle response
}
```

Available Resources and Operations
----------------------------------

[](#available-resources-and-operations)

Available methods### [accounts](docs/sdks/accounts/README.md)

[](#accounts)

- [get](docs/sdks/accounts/README.md#get) - Retrieve account details
- [getSubaccount](docs/sdks/accounts/README.md#getsubaccount) - Get subaccount details

#### [addressBook-&gt;contacts](docs/sdks/contacts/README.md)

[](#addressbook-contacts)

- [list](docs/sdks/contacts/README.md#list) - List contacts
- [add](docs/sdks/contacts/README.md#add) - Add a new contact
- [get](docs/sdks/contacts/README.md#get) - Retrieve contact details
- [update](docs/sdks/contacts/README.md#update) - Update a contact
- [delete](docs/sdks/contacts/README.md#delete) - Delete a contact
- [removeFromGroup](docs/sdks/contacts/README.md#removefromgroup) - Remove a contact from a group
- [addToGroup](docs/sdks/contacts/README.md#addtogroup) - Add a contact to a group

#### [addressBook-&gt;contacts-&gt;byExtId](docs/sdks/byextid/README.md)

[](#addressbook-contacts-byextid)

- [get](docs/sdks/byextid/README.md#get) - Retrieve contact details by EXT\_ID
- [update](docs/sdks/byextid/README.md#update) - Update a contact by EXT\_ID
- [delete](docs/sdks/byextid/README.md#delete) - Delete a contact by EXT\_ID
- [removeFromGroup](docs/sdks/byextid/README.md#removefromgroup) - Remove a contact from a group by EXT\_ID
- [addToGroup](docs/sdks/byextid/README.md#addtogroup) - Add a contact to a group by EXT\_ID

#### [addressBook-&gt;groups](docs/sdks/groups/README.md)

[](#addressbook-groups)

- [list](docs/sdks/groups/README.md#list) - List groups
- [add](docs/sdks/groups/README.md#add) - Add a new group
- [get](docs/sdks/groups/README.md#get) - Retrieve group details
- [update](docs/sdks/groups/README.md#update) - Update a group
- [delete](docs/sdks/groups/README.md#delete) - Delete a group

### [common](docs/sdks/common/README.md)

[](#common)

- [ping](docs/sdks/common/README.md#ping) - Check API availability and version

### [metadata](docs/sdks/metadata/README.md)

[](#metadata)

- [list](docs/sdks/metadata/README.md#list) - List metadata
- [getPredefinedConfigs](docs/sdks/metadata/README.md#getpredefinedconfigs) - List predefined configs

### [senders](docs/sdks/senders/README.md)

[](#senders)

- [list](docs/sdks/senders/README.md#list) - List senders
- [add](docs/sdks/senders/README.md#add) - Add a new sender
- [delete](docs/sdks/senders/README.md#delete) - Delete a sender
- [verify](docs/sdks/senders/README.md#verify) - Verify sender

### [shipments](docs/sdks/shipments/README.md)

[](#shipments)

- [status](docs/sdks/shipments/README.md#status) - Retrieve shipment details with status events
- [cancel](docs/sdks/shipments/README.md#cancel) - Cancel shipments
- [dispatch](docs/sdks/shipments/README.md#dispatch) - Dispatch a new shipment
- [documents](docs/sdks/shipments/README.md#documents) - Retrieve documents related to a shipment
- [price](docs/sdks/shipments/README.md#price) - Check the shipment price

Retries
-------

[](#retries)

Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.

To change the default retry strategy for a single API call, simply provide an `Options` object built with a `RetryConfig` object to the call:

```
declare(strict_types=1);

require 'vendor/autoload.php';

use Postivo;
use Postivo\Utils\Retry;

$sdk = Postivo\Client::builder()
    ->setSecurity(
        ''
    )
    ->build();

$response = $sdk->accounts->get(
    options: Utils\Options->builder()->setRetryConfig(
        new Retry\RetryConfigBackoff(
            initialInterval: 1,
            maxInterval:     50,
            exponent:        1.1,
            maxElapsedTime:  100,
            retryConnectionErrors: false,
        ))->build()
);

if ($response->accountResponse !== null) {
    // handle response
}
```

If you'd like to override the default retry strategy for all operations that support retries, you can pass a `RetryConfig` object to the `SDKBuilder->setRetryConfig` function when initializing the SDK:

```
declare(strict_types=1);

require 'vendor/autoload.php';

use Postivo;
use Postivo\Utils\Retry;

$sdk = Postivo\Client::builder()
    ->setRetryConfig(
        new Retry\RetryConfigBackoff(
            initialInterval: 1,
            maxInterval:     50,
            exponent:        1.1,
            maxElapsedTime:  100,
            retryConnectionErrors: false,
        )
  )
    ->setSecurity(
        ''
    )
    ->build();

$response = $sdk->accounts->get(

);

if ($response->accountResponse !== null) {
    // handle response
}
```

Error Handling
--------------

[](#error-handling)

Handling errors in this SDK should largely match your expectations. All operations return a response object or throw an exception.

By default an API error will raise a `Errors\APIException` exception, which has the following properties:

PropertyTypeDescription`$message`*string*The error message`$statusCode`*int*The HTTP status code`$rawResponse`*?\\Psr\\Http\\Message\\ResponseInterface*The raw HTTP response`$body`*string*The response contentWhen custom error responses are specified for an operation, the SDK may also throw their associated exception. You can refer to respective *Errors* tables in SDK docs for more details on possible exception types for each operation. For example, the `get` method throws the following exceptions:

Error TypeStatus CodeContent TypeErrors\\ErrorResponse401, 403, 4XXapplication/problem+jsonErrors\\ErrorResponse5XXapplication/problem+json### Example

[](#example)

```
declare(strict_types=1);

require 'vendor/autoload.php';

use Postivo;
use Postivo\Models\Errors;

$sdk = Postivo\Client::builder()
    ->setSecurity(
        ''
    )
    ->build();

try {
    $response = $sdk->accounts->get(

    );

    if ($response->accountResponse !== null) {
        // handle response
    }
} catch (Errors\ErrorResponseThrowable $e) {
    // handle $e->$container data
    throw $e;
} catch (Errors\ErrorResponseThrowable $e) {
    // handle $e->$container data
    throw $e;
} catch (Errors\APIException $e) {
    // handle default exception
    throw $e;
}
```

Server Selection
----------------

[](#server-selection)

### Select Server by Name

[](#select-server-by-name)

You can override the default server globally using the `setServer(string $serverName)` builder method when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the names associated with the available servers:

NameServerDescription`prod``https://api.postivo.pl/rest/v1`Production system`sandbox``https://api.postivo.pl/rest-sandbox/v1`Test system (SANDBOX)#### Example

[](#example-1)

```
declare(strict_types=1);

require 'vendor/autoload.php';

use Postivo;

$sdk = Postivo\Client::builder()
    ->setServer('sandbox')
    ->setSecurity(
        ''
    )
    ->build();

$response = $sdk->accounts->get(

);

if ($response->accountResponse !== null) {
    // handle response
}
```

### Override Server URL Per-Client

[](#override-server-url-per-client)

The default server can also be overridden globally using the `setServerUrl(string $serverUrl)` builder method when initializing the SDK client instance. For example:

```
declare(strict_types=1);

require 'vendor/autoload.php';

use Postivo;

$sdk = Postivo\Client::builder()
    ->setServerURL('https://api.postivo.pl/rest/v1')
    ->setSecurity(
        ''
    )
    ->build();

$response = $sdk->accounts->get(

);

if ($response->accountResponse !== null) {
    // handle response
}
```

Development
===========

[](#development)

Maturity
--------

[](#maturity)

This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally looking for the latest version.

Contributions
-------------

[](#contributions)

While we value open-source contributions to this SDK, this library is generated programmatically. Any manual changes added to internal files will be overwritten on the next generation. We look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release.

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance66

Regular maintenance activity

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~3 days

Total

3

Last Release

207d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5f1fc8c67f77ed70a60610cf83536d4f9a323ead0cdef3813f1f4f90609309a1?d=identicon)[gsmservice](/maintainers/gsmservice)

---

Top Contributors

[![tommekk83](https://avatars.githubusercontent.com/u/130782947?v=4)](https://github.com/tommekk83 "tommekk83 (4 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/postivo-postivo-client/health.svg)

```
[![Health](https://phpackages.com/badges/postivo-postivo-client/health.svg)](https://phpackages.com/packages/postivo-postivo-client)
```

###  Alternatives

[clerkinc/backend-php

2755.0k](/packages/clerkinc-backend-php)[polar-sh/sdk

4014.5k4](/packages/polar-sh-sdk)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[dnsimple/dnsimple

The DNSimple API client for PHP.

11190.9k1](/packages/dnsimple-dnsimple)[hardcastle/xrpl_php

PHP SDK / Client for the XRP Ledger

129.7k5](/packages/hardcastle-xrpl-php)

PHPackages © 2026

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