PHPackages                             metabytes-sro/epost-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. metabytes-sro/epost-api

ActiveLibrary[API Development](/categories/api)

metabytes-sro/epost-api
=======================

E-POSTBUSINESS API PHP integration

v1.0.0(2mo ago)412.5k↓33.3%3[1 issues](https://github.com/metabytes-sro/epost-api/issues)LGPL-3.0-or-laterPHPPHP ^8.1

Since Oct 5Pushed 2mo ago2 watchersCompare

[ Source](https://github.com/metabytes-sro/epost-api)[ Packagist](https://packagist.org/packages/metabytes-sro/epost-api)[ Fund](https://metabytes.eu)[ RSS](/packages/metabytes-sro-epost-api/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (8)Used By (0)

E-POSTBUSINESS API V2 PHP integration
=====================================

[](#e-postbusiness-api-v2-php-integration)

[![Latest Version on Packagist](https://camo.githubusercontent.com/5a9d06912cb031ccba02aa26d16f638d644eb3d45a3c37d398946fa3952c764a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d65746162797465732d73726f2f65706f73742d6170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/metabytes-sro/epost-api)

PHP integration for the [E-POSTBUSINESS API](https://api.epost.docuguide.com/swagger/index.html) for electronic submission of documents that are subsequently sent as physical letters.

Install
-------

[](#install)

```
composer require metabytes-sro/epost-api
```

Upgrading
---------

[](#upgrading)

See [UPGRADE.md](UPGRADE.md) for migration instructions when upgrading between versions.

Requirements
------------

[](#requirements)

- PHP ^8.1
- guzzlehttp/guzzle ^7.0.1

Usage
-----

[](#usage)

### Authentication

[](#authentication)

Obtain an access token via the [OAuth2 Provider](https://github.com/richardhj/oauth2-epost) or the built-in Login:

```
use MetabytesSRO\EPost\Api\AccessToken;
use MetabytesSRO\EPost\Api\Letter;

$token = new AccessToken($vendorID, $ekp, $secret, $password);
```

### Sending a letter

[](#sending-a-letter)

```
use MetabytesSRO\EPost\Api\Letter;
use MetabytesSRO\EPost\Api\Metadata\Envelope;
use MetabytesSRO\EPost\Api\Metadata\Envelope\Recipient;
use MetabytesSRO\EPost\Api\Metadata\DeliveryOptions;

$letter = new Letter();
$envelope = new Envelope();
$recipient = new Recipient();
$recipient
    ->setAddressLine('Max Mustermann AG', 0)   // addressLine1
    ->setAddressLine('Musterstrasse 99', 1)    // addressLine2
    ->setZipCode('12345')
    ->setCity('Bonn');

$envelope->setRecipient($recipient);

$letter
    ->setAccessToken($token)
    ->setEnvelope($envelope)
    ->setAttachment('/path/to/document.pdf')
    ->setTestEnvironment(true);

// Optional: cover letter (PDF path)
$letter->setCoverLetter('/path/to/cover.pdf');

// Optional: test mode - receive PDF at email instead of physical send
$letter->setTestEmail('test@example.com');

try {
    $letter->send();
    $letterId = $letter->getLetterId();
} catch (MetabytesSRO\EPost\Api\Exception\ErrorException $e) {
    $error = $e->getError();
    // $error->getCode(), $error->getDescription()
}
```

### Einschreiben (registered mail) with return receipt

[](#einschreiben-registered-mail-with-return-receipt)

When using "Einschreiben Rückschein" or "Einschreiben eigenhändig Rückschein", you must provide the return address where the handwritten delivery confirmation is sent:

```
use MetabytesSRO\EPost\Api\Metadata\DeliveryOptions;
use MetabytesSRO\EPost\Api\Metadata\RegisteredLetterReturnAddress;

$deliveryOptions = new DeliveryOptions();
$deliveryOptions
    ->setRegisteredWithReturnReceipt()  // or setRegisteredAddresseeOnlyWithReturnReceipt()
    ->setColorColored();

$returnAddress = new RegisteredLetterReturnAddress();
$returnAddress
    ->setAddressLine1('My Company GmbH')
    ->setZipCode('53115')
    ->setCity('Bonn');

$deliveryOptions->setRegisteredLetterReturnAddress($returnAddress);
$letter->setDeliveryOptions($deliveryOptions);
```

### Batch sending

[](#batch-sending)

Send multiple letters in one API request:

```
$letters = [$letter1, $letter2, $letter3];
$letter->setAccessToken($token);
$results = $letter->sendBatch($letters);
foreach ($results as $result) {
    $letterId = $result->getLetterId();
}
```

### Status queries

[](#status-queries)

```
// Single letter
$status = $letter->getLetterStatus($letterId);

// Multiple by IDs
$statuses = $letter->getMultipleLetterStatuses([123, 456], $onlyIssues = false);

// By date range
$statuses = $letter->getLetterStatusByDateRange('2024-01-01', '2024-01-31');

// Open letters (status 1–3, not yet sent)
$statuses = $letter->getOpenLetters();

// Einschreiben (registered letters) by date range
$statuses = $letter->getRegisteredLetterStatus('2024-01-01', '2024-01-31', $onlyOpen = false);

// Einschreiben tracking status (resolve code to description)
$status = $letter->getLetterStatus($letterId);
$trackCode = $status->getRegisteredLetterStatus();  // e.g. "DELIVERED", "IN_DELIVERY"
$description = \MetabytesSRO\EPost\Api\TrackStatusCodes::getDescription($trackCode);  // German description
$isFinal = \MetabytesSRO\EPost\Api\TrackStatusCodes::isFinal($trackCode);  // true if delivery complete

// Search by custom1 field
$statuses = $letter->getLetterStatusByCustom1('RE-000123');

// By batch ID
$statuses = $letter->getLetterStatusByBatch(12345);
```

### UploadManagement plugin (queued letters)

[](#uploadmanagement-plugin-queued-letters)

For letters submitted with the UploadManagement plugin:

```
// Cancel queued letters
$results = $letter->cancelQueued([74567567, 65765678]);

// Release (expedite) queued letters
$results = $letter->releaseQueued([74567567, 65765678]);
```

### PremiumAdress feedback

[](#premiumadress-feedback)

```
$feedback = $letter->getPremiumAdressFeedback('2024-01-01', '2024-01-31');
```

### Price estimation

[](#price-estimation)

The E-POSTBUSINESS API does not provide a pricing endpoint for Letter (hybrid mail). Use the built-in calculator with official price lists (valid from 01.01.2025):

```
use MetabytesSRO\EPost\Api\Pricing\LetterPriceCalculator;
use MetabytesSRO\EPost\Api\Pricing\PriceConfig;

// Default prices from Deutsche Post (Tarif Basis)
$calculator = LetterPriceCalculator::fromEnv();

// Single letter: weight (g), pages, color, duplex, international
$price = $calculator->calculate(20, 1, false, false, false);  // 0.80 € national standard

// Batch
$total = $calculator->calculateBatch(100, 50, 4, true, false, false);
```

**Environment variables** (optional):

VariableDescription`EPOST_TARIFF``basis` (default) or `250plus``EPOST_PRICES_JSON`JSON object to override default prices (e.g. negotiated rates)Example `.env`:

```
EPOST_TARIFF=250plus
# EPOST_PRICES_JSON={"national":{"basis":{"standard":{"sw_simplex":0.75}}}}

```

Price sources: [National](https://www.deutschepost.de/dam/jcr:4f6b160f-5beb-470a-9891-81e02acdd6e6/dp-epost-preisliste-mailer-basis_250+-ab%2001012025.pdf), [International](https://www.deutschepost.de/dam/jcr:d7e72ba2-a855-4b1d-9300-3c5c6745bf86/dp-epost-preisliste-international-mailer-basis-ab-01012025_vf.pdf)

API reference
-------------

[](#api-reference)

See the [E-POSTBUSINESS API Swagger documentation](https://api.epost.docuguide.com/swagger/index.html) for full details.

Supporting the project
----------------------

[](#supporting-the-project)

If this package is useful to you and you would like to support further development, we welcome donations. Please get in touch via [metabytes.eu](https://metabytes.eu) or . We are also open to feature requests.

License
-------

[](#license)

LGPL-3.0+

Contributing
------------

[](#contributing)

Please follow the [Symfony Coding Standards](http://symfony.com/doc/current/contributing/code/standards.html).

###  Health Score

54

—

FairBetter than 97% of packages

Maintenance78

Regular maintenance activity

Popularity31

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity77

Established project with proven stability

 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

Every ~1142 days

Total

4

Last Release

85d ago

Major Versions

v0.11-beta → v1.0.02026-02-23

PHP version history (3 changes)v0.9.0PHP ^5.4 || ^7.0

v0.10-beta.1PHP ^7.0

v1.0.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/9336c1b9ee8b007c3eac0aff0f53c48524d011393b37f15b81f9bb37cc409c3c?d=identicon)[Metabytes s.r.o.](/maintainers/Metabytes%20s.r.o.)

---

Top Contributors

[![Quosimadu](https://avatars.githubusercontent.com/u/10835161?v=4)](https://github.com/Quosimadu "Quosimadu (16 commits)")[![richardhj](https://avatars.githubusercontent.com/u/1284725?v=4)](https://github.com/richardhj "richardhj (16 commits)")[![mantakIntegrus](https://avatars.githubusercontent.com/u/62660996?v=4)](https://github.com/mantakIntegrus "mantakIntegrus (15 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/metabytes-sro-epost-api/health.svg)

```
[![Health](https://phpackages.com/badges/metabytes-sro-epost-api/health.svg)](https://phpackages.com/packages/metabytes-sro-epost-api)
```

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

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

Kit PHP SDK for the Kit API

2167.1k1](/packages/convertkit-convertkitapi)[mapado/rest-client-sdk

Rest Client SDK for hydra API

1125.9k2](/packages/mapado-rest-client-sdk)

PHPackages © 2026

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