PHPackages                             bohemicastudio/ppl-myapi - 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. bohemicastudio/ppl-myapi

ActiveLibrary[API Development](/categories/api)

bohemicastudio/ppl-myapi
========================

PHP Laravel package for PPL myApi 2 (CPL API)

v1.0.2(1y ago)13[4 PRs](https://github.com/bohemicastudio/ppl-myapi/pulls)MITPHPPHP ^8.1CI passing

Since Feb 23Pushed 1mo agoCompare

[ Source](https://github.com/bohemicastudio/ppl-myapi)[ Packagist](https://packagist.org/packages/bohemicastudio/ppl-myapi)[ Docs](https://github.com/bohemicastudio/ppl-myapi)[ GitHub Sponsors](https://github.com/BohemicaStudio)[ RSS](/packages/bohemicastudio-ppl-myapi/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (14)Versions (8)Used By (0)

PHP Laravel package for PPL myApi 2 Integration
===============================================

[](#php-laravel-package-for-ppl-myapi-2-integration)

[![Latest Version on Packagist](https://camo.githubusercontent.com/c5245ac8a8adc5488f3366bce40a6d6c003cf47eb22023f7f0d395af2369adc4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f626f68656d69636173747564696f2f70706c2d6d796170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/bohemicastudio/ppl-myapi)[![GitHub Tests Action Status](https://camo.githubusercontent.com/3ae520096193c5a12d2a4f556c99dc441de30439389d2863087676065206d905/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f626f68656d69636173747564696f2f70706c2d6d796170692f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/bohemicastudio/ppl-myapi/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/776a8ce0024a855ce38fe655a6370be692cb011050fb4dd5039e74592861bf0d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f626f68656d69636173747564696f2f70706c2d6d796170692f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/bohemicastudio/ppl-myapi/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/2e99931096cc66e556844c8f8b8fc0eb89339b01044bfe798ae45bc693b0b423/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f626f68656d69636173747564696f2f70706c2d6d796170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/bohemicastudio/ppl-myapi)

This package provides a straightforward and easy-to-use integration with **PPL myApi 2**, focusing on **creating shipments** and **downloading shipping labels** within the PPL system. Rather than implementing the entire API, this package is designed to cover only the **essential features** needed for shipment processing.

While our primary focus is on shipment creation, we welcome **community contributions** and encourage pull requests for additional features.

Features
--------

[](#features)

- Full support for all `/codelist/` endpoints
- Shipment creation via `POST /shipment/batch`
- Label download (retrievable from the shipment creation response)
- Direct API requests via `PplMyApi::request`, with customizable response handling

For detailed implementation instructions, see the [Usage](#usage) section below.

Additional Resources
--------------------

[](#additional-resources)

- Official API documentation: [PPL Sandbox](https://sandbox.ppl.cz/)
- Need help? Open an issue on GitHub

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require bohemicastudio/ppl-myapi
```

You have to publish the config file and setup proper credentials:

```
php artisan vendor:publish --tag="ppl-myapi-config"
```

This is the contents of the published config file:

```
return [
    'client_id' => env('PPL_MYAPI2_CLIENT_ID'),
    'client_secret' => env('PPL_MYAPI2_CLIENT_SECRET'),
    'production' => env('PPL_MYAPI2_PRODUCTION', false),
    'access_token_url' => env('PPL_MYAPI2_ACCESS_TOKEN_URL', env('PPL_MYAPI2_PRODUCTION') ? 'https://api.dhl.com/ecs/ppl/myapi2/login/getAccessToken' : 'https://api-dev.dhl.com/ecs/ppl/myapi2/login/getAccessToken'),
    'base_url' => env('PPL_MYAPI2_BASE_URL', env('PPL_MYAPI2_PRODUCTION') ? 'https://api.dhl.com/ecs/ppl/myapi2' : 'https://api-dev.dhl.com/ecs/ppl/myapi2'),
];
```

Usage
-----

[](#usage)

Below is a basic example of how to create a shipment batch using this package and download the labels. You can customize the shipment details by adding additional fields as needed. The provided models ensure a structured approach to handling shipments efficiently.

```
use BohemicaStudio\PplMyApi\Enums\ProductList;
use BohemicaStudio\PplMyApi\Models\Data\Shipment\ShipmentBatch;
use BohemicaStudio\PplMyApi\Models\Data\Shipment\Shipment;
use BohemicaStudio\PplMyApi\Models\Data\Shipment\Address;
use BohemicaStudio\PplMyApi\Models\Data\Shipment\CashOnDelivery;
use BohemicaStudio\PplMyApi\Models\Data\Shipment\ShipmentSet;
use BohemicaStudio\PplMyApi\Models\Data\Shipment\LabelSettings;
use BohemicaStudio\PplMyApi\Models\Data\Shipment\CompleteLabelSettings;
use BohemicaStudio\PplMyApi\Services\PplMyApiShipmentService;
use BohemicaStudio\PplMyApi\PplMyApi;
use GuzzleHttp\Exception\ClientException;

// First, create a shipment batch. This is a basic example; you can add more fields as required.
$shipmentBatch = new ShipmentBatch(
    shipments: [
        new Shipment(
            // Ideally, use PplMyApiCodelistService to fetch all product types, but you can also use enum as we assume it won't change
            productType: ProductList::ParcelCzechBusinessCod->value,
            recipient: new Address(
                country: 'CZ',
                zipCode: '15500',
                name: 'Company Name',
                name2: 'Company Name',
                street: 'Street 10/1',
                city: 'Praha 13',
                contact: 'John Doe',
                phone: '+420123456789',
                email: 'receipient@example.com',
            ),
            referenceId: '96aeaec1-4ca6-49f5-b0a6-8eef258586a5',
            sender: new Address(
                country: 'CZ',
                zipCode: '15500',
                name: 'Your Company Name',
                name2: 'Your Company Name',
                street: 'Your Street 10/1',
                city: 'Praha 13',
                contact: 'Your Name',
                phone: '+420223456789',
                email: 'sender@example.com',
            ),
            cashOnDelivery: new CashOnDelivery(
                codCurrency: 'CZK',
                codPrice: 1000,
                codVarSym: '1234567890',
            ),
            shipmentSet: new ShipmentSet(
                numberOfShipments: 2, // Number of packages in the shipment
                shipmentSetItems: [],
            ),
        ),
    ],
    labelSettings: new LabelSettings(
        format: 'Pdf',
        completeLabelSettings: new CompleteLabelSettings(
            isCompleteLabelRequested: true,
            pageSize: 'A4',
        ),
    ),
    shipmentsOrderBy: 'ShipmentNumber',
);

$pplApi = new PplMyApi();
$service = new PplMyApiShipmentService($pplApi);

try {
    $shipmentBatchUrl = $service->createShipmentBatch($shipmentBatch);
} catch (ClientException $e) {
    // You may want to output the validation error
    dd($e->getResponse()->getBody()->getContents());
}

// Ideally, you should create a delayed queued job for this, that will try this after 1 minute and repeat for let's say 10 minutes (as PPL API does not provide any webhook or callback)
// But if you are forced to do it in the same request, you can do it like this:
$attempts = 0;
while ($attempts < 24) {
    sleep($attempts === 0 ? 3 : 2);
    // Then we can get the shipment batch detail - parsing of shipment batch detail will work only if there is only one shipment in the batch
    // Otherwise you need to parse the response yourself
    $detail = $service->getShipmentBatchDetail($shipmentBatchUrl);
    if ($detail->isFullyCompleted()) {
        $count = 0;
        foreach ($detail->items as $item) {
            // Make sure the directory exists
            $name = 'pdf/' . $item->shipmentNumber . '_' . $count . '.pdf';
            file_put_contents(public_path($name), $pplApi->request($item->labelUrl)->getBody()->getContents());
            $count++;
        }

        break;
    }

    $attempts++;
}
```

This example demonstrates the core structure for creating a shipment. Be sure to adjust the shipment details based on your requirements.

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Bohemica Studio](https://github.com/BohemicaStudio)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

With ❤️ by Bohemica Studio &amp; Alex Kratky
--------------------------------------------

[](#with-️-by-bohemica-studio--alex-kratky)

- [Contact webpage](https://bohemicastudio.com/)
- [Github webpage](https://github.com/bohemicastudio)
- [Github webpage of Alex Kratky](https://github.com/alexkratky)

This package was inspired by [PplMyApi](https://github.com/Salamek/PplMyApi) and [php-ppl-create-package-label-api](https://github.com/szymsza/php-ppl-create-package-label-api).

Searching for Uncomplicated Digital Signage?
--------------------------------------------

[](#searching-for-uncomplicated-digital-signage)

Discover **[Bohemica Signage](https://bohemicasignage.com/)**—the hassle-free way to manage digital displays!

###  Health Score

37

—

LowBetter than 82% of packages

Maintenance76

Regular maintenance activity

Popularity5

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 70% 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 ~0 days

Total

3

Last Release

440d ago

### Community

Maintainers

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

---

Top Contributors

[![AlexKratky](https://avatars.githubusercontent.com/u/33813757?v=4)](https://github.com/AlexKratky "AlexKratky (14 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (3 commits)")

---

Tags

api-clientcpldhlmyapimyapi2phppplppl-cplppl-myapilaravelPPLCPLBohemica Studioppl-myapi

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/bohemicastudio-ppl-myapi/health.svg)

```
[![Health](https://phpackages.com/badges/bohemicastudio-ppl-myapi/health.svg)](https://phpackages.com/packages/bohemicastudio-ppl-myapi)
```

###  Alternatives

[simplestats-io/laravel-client

Client for SimpleStats!

4515.5k](/packages/simplestats-io-laravel-client)[scalar/laravel

Render your OpenAPI-based API reference

6183.9k2](/packages/scalar-laravel)[ryangjchandler/bearer

Minimalistic token-based authentication for Laravel API endpoints.

8129.8k](/packages/ryangjchandler-bearer)[codebar-ag/laravel-docuware

DocuWare integration with Laravel

1221.1k](/packages/codebar-ag-laravel-docuware)[combindma/laravel-facebook-pixel

Meta pixel integration for Laravel

4956.9k](/packages/combindma-laravel-facebook-pixel)[stechstudio/laravel-hubspot

A Laravel SDK for the HubSpot CRM Api

2971.0k](/packages/stechstudio-laravel-hubspot)

PHPackages © 2026

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