PHPackages                             deliverymatch/pdk - 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. deliverymatch/pdk

ActiveLibrary

deliverymatch/pdk
=================

v1.0.1(6mo ago)0127PHPPHP &gt;=8.1

Since Oct 9Pushed 6mo ago2 watchersCompare

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

READMEChangelogDependencies (9)Versions (3)Used By (0)

DeliveryMatch Plugin Development Kit
====================================

[](#deliverymatch-plugin-development-kit)

The DeliveryMatch Plugin Development Kit (PDK) is built for creating easy integrations with PHP E-commerce platforms. This library is a wrapper around the [SDK](https://www.github.com/deliverymatch/SDK)

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

[](#requirements)

- PHP &gt;= 8.1
- A [PSR-17 implementation](https://packagist.org/providers/psr/http-factory-implementation)
- A [PSR-18 implementation](https://packagist.org/providers/psr/http-client-implementation)
- Composer

Getting Started
---------------

[](#getting-started)

Install the package using Composer:

```
composer require deliverymatch/pdk
```

### Implement the [`Repository`](./src/Common/Repository.php) interface

[](#implement-the-repository-interface)

During the checkout process the PDK needs access the same data across multiple requests. Most E-commerce platforms give you access to cookie, session, cache and database storage.

```
class MyWebshopDataRepository implements \DeliveryMatch\Pdk\Common\Repository
{
    public function setShipmentId(int $shipmentId): void
    {
        Session::set($shipmentId, "dm_shipment_id");
    }

    public function getShipmentId(): ?int
    {
        return Session::get("dm_shipment_id");
    }

    public function setShippingOptions(array $shippingOptions): void
    {
        $shipmentId = $this->getShipmentId();

        Redis::save(key: $shipmentId, base64_encode(serialize($shippingOptions)));
    }

    public function getShippingOptions(): array
    {
        $shipmentId = $this->getShipmentId();

        if ($shipmentId === null) {
            return [];
        }

        $serializedOptions = Redis::get(key: $shipmentId);

        return unserialize(base64_decode($serializedOptions));
    }

    public function setCheckId(string $checkId): void
    {
        Session::set($checkId, "dm_check_id");
    }

    public function getCheckId(): ?string
    {
        return Session::get("dm_check_id");
    }

    public function flush(): void
    {
        $shipmentId = $this->getShipmentId();
        Redis::flush(key: $shipmentId);
        Session::clear("dm_check_id");
        Session::clear("dm_shipment_id");
    }
}
```

### Create a PDK Bootstrapper

[](#create-a-pdk-bootstrapper)

The Bootstrapper is used to provide the dependency injection container in de PDK with an implementation of the [`Repository`](./src/Common/Repository.php) interface. After the creation of the bootstrapper call the `::setup()` method to initialize everything.

```
class MyWebshopPdkBootstrapper extends \DeliveryMatch\Pdk\Common\PdkBootstrapper
{
    protected function getAdditionalConfiguration(): array
    {
        return [
            \DeliveryMatch\Pdk\Common\Repository::class => \DI\autowire(MyWebshopDataRepository::class),
        ];
    }
}
```

### Interact with the PDK

[](#interact-with-the-pdk)

Once the PDK is successfully bootstrapped you can use the PDK to interact with DeliveryMatch using the [`\Facade\Pdk`](./src/Facade/Pdk.php).

Check if the API connection is successful:

```
$isAuthenticated = \DeliveryMatch\Pdk\Facade\Pdk::checkConnection();
```

Fetch shipping options:

```
$rates = \DeliveryMatch\Pdk\Facade\Pdk::fetchShippingOptions($request);
```

Store the selected shipping option in the PDK:

```
\DeliveryMatch\Pdk\Facade\Pdk::setSelectedOption($this->request->checkId);
```

Push the selected shipping option to DeliveryMatch. (Not efficient to do this after every method change in the checkout, best to do this after the checkout is completed)

```
\DeliveryMatch\Pdk\Facade\Pdk::addShippingOptionToShipment();
```

Flush the repository when the checkout is completed. Store the shipment id with the corresponding order from the E-commerce platform.

```
// add shipping option to DeliveryMatch
\DeliveryMatch\Pdk\Facade\Pdk::addShippingOptionToShipment();

// Get the repository to fetch the shipment id
$repository = \DeliveryMatch\Pdk\Facade\Pdk::get(\DeliveryMatch\Pdk\Common\Repository::class);
$shipmentId = $cache->getShipmentId;

// Fetch E-Commerce order from the database
// Store dm shipmentId with the order
$eComOrder = Orders::get(123);
$eComOrder->dm_shipment_id = $shipmentId;
$eComOrder->save();

// Flush repository
$repository->flush();
```

Update the shipment to new when the payment is received. You also have the option to update the order number. Not all E-commerce platforms provide an oder number before the checkout is completed.

```
\DeliveryMatch\Pdk\Facade\Pdk::updateShipmentToNew(shipmentId: $shipmentId, orderNumber: $order->number);
```

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance67

Regular maintenance activity

Popularity10

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity45

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 ~29 days

Total

2

Last Release

191d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7a753153fc0a9fbeda9d7d886b7762c1b16cacb1f2339b329435953f3a247bea?d=identicon)[DeliveryMatch](/maintainers/DeliveryMatch)

---

Top Contributors

[![koen-dm](https://avatars.githubusercontent.com/u/55694567?v=4)](https://github.com/koen-dm "koen-dm (57 commits)")

---

Tags

library

###  Code Quality

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/deliverymatch-pdk/health.svg)

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

###  Alternatives

[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.4k37.3k](/packages/matomo-matomo)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[zbateson/mail-mime-parser

MIME email message parser

53949.2M79](/packages/zbateson-mail-mime-parser)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[simplesamlphp/saml2

SAML2 PHP library from SimpleSAMLphp

30317.2M40](/packages/simplesamlphp-saml2)[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.7k15.7k5](/packages/elgg-elgg)

PHPackages © 2026

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