PHPackages                             marshmallow/keen-delivery - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. marshmallow/keen-delivery

ActiveLibrary[HTTP &amp; Networking](/categories/http)

marshmallow/keen-delivery
=========================

Connect your Laravel application to Keen Delivery

v3.0.0(7mo ago)02.1k↓100%[1 issues](https://github.com/marshmallow-packages/keen-delivery/issues)MITPHPPHP ^8.0CI failing

Since Nov 19Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/marshmallow-packages/keen-delivery)[ Packagist](https://packagist.org/packages/marshmallow/keen-delivery)[ Docs](https://github.com/Marshmallow-Development/)[ RSS](/packages/marshmallow-keen-delivery/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (4)Versions (12)Used By (0)

[![alt text](https://camo.githubusercontent.com/f5450f299f5713ce2f04dd5a1ba7ce9960ed4568b3574e4c4ee3cddc75477253/68747470733a2f2f6d617273686d616c6c6f772e6465762f63646e2f6d656469612f6c6f676f2d7265642d3233377834362e706e67 "marshmallow.")](https://camo.githubusercontent.com/f5450f299f5713ce2f04dd5a1ba7ce9960ed4568b3574e4c4ee3cddc75477253/68747470733a2f2f6d617273686d616c6c6f772e6465762f63646e2f6d656469612f6c6f676f2d7265642d3233377834362e706e67)

Laravel Keen Delivery
=====================

[](#laravel-keen-delivery)

[![Latest Version on Packagist](https://camo.githubusercontent.com/4aff4f5857cbf51daa815ee0750f1933096577691f0ad116fbb8ca93833cff69/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d617273686d616c6c6f772f6b65656e2d64656c69766572792e7376673f763d31)](https://github.com/marshmallow-packages/keen-delivery)[![Total Downloads](https://camo.githubusercontent.com/6d9f0cf544582000bde0b81ff83dd7e50702494e85cd50a9fe94c7482eb3386b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d617273686d616c6c6f772f6b65656e2d64656c69766572792e7376673f763d31)](https://github.com/marshmallow-packages/keen-delivery)[![Issues](https://camo.githubusercontent.com/a4008df46d71726e4eadd6b1dcf0164f12ec3b04fd41366e7741012a42488fb4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f6d617273686d616c6c6f772d7061636b616765732f6b65656e2d64656c6976657279)](https://github.com/marshmallow-packages/keen-delivery)[![Stars](https://camo.githubusercontent.com/067d7e007642fef76f8861d10a4d64179adfe31a07a43aa4e8004f7bfbfc5520/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6d617273686d616c6c6f772d7061636b616765732f6b65656e2d64656c6976657279)](https://github.com/marshmallow-packages/keen-delivery)[![Forks](https://camo.githubusercontent.com/16c83f07f989bd3aa430107733c09a8b719a703168bcec869e55ecf14185a190/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f6d617273686d616c6c6f772d7061636b616765732f6b65656e2d64656c6976657279)](https://github.com/marshmallow-packages/keen-delivery)

This package makes it easy to link with the Keen Delivery API. You connect it by simply adding a trait to your model which should be able to be shipped. The package takes care of the rest. We've also added a number of features to make it easy to manage your shipments via Laravel Nova.

[![DeliveryActions](https://camo.githubusercontent.com/18e2487fc26cbaf27e82b3e5aaab70b77cdcba47626032b2ba009f27bb5331e6/68747470733a2f2f6d617273686d616c6c6f772e6465762f63646e2f726561646d652f6b65656e2d64656c69766572792f44656c6976657279416374696f6e732e706e67)](https://camo.githubusercontent.com/18e2487fc26cbaf27e82b3e5aaab70b77cdcba47626032b2ba009f27bb5331e6/68747470733a2f2f6d617273686d616c6c6f772e6465762f63646e2f726561646d652f6b65656e2d64656c69766572792f44656c6976657279416374696f6e732e706e67)

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

[](#installation)

You can install this package using composer.

```
composer require marshmallow/keen-delivery
```

### Migrations

[](#migrations)

Run the migrations. The migration will create a table in your database where all shipments will be stored. We will also store the request and response to/of the Keen Delivery API.

```
php artisan migrate
```

### Publish the config

[](#publish-the-config)

After publishing the config, please change the config to your specifications. Below you will find an explanation of all the config values.

```
php artisan vendor:publish --provider="Marshmallow\KeenDelivery\ServiceProvider" --tag="config"
```

Key\#1api\_pathThis is the base path of the Keen Delivery API.api\_tokenThis will load your API key from you `.env` filedefault\_carrierThis will hold the default carrier you wish to use. You can also provide this manually when creating a shipment. Please reference the Carriers table at the bottom of this README file to see which carries are currently supported.default\_carrier\_serviceThis will hold the default service you wish to use. You can also provide this manually when creating a shipment. Please reference the Carriers table at the bottom of this README file to see which services are currently supported.delivery\_modelsAdd any Nova Resource that should be able to be shipped to this array. By default we will add `App\Nova\Order` because this is most common in our own projectsroutesThis holds the routes which are used for download shipment labels. These are added to the config to make this package highly customizable.routes.\*.pathThe path of the route that is loaded.routes.\*.nameThe name of the routeroutes.\*.controllerThe controller connected to the route. Please not that this controller should have an `__invoke()` method where all the magic happens.routes.\*.ttlThe routes that are generated for downloading a label or downloading bulk labels are signed routes. Here you can add the amount of minutes that this signed URL should be valid.### Update your .env

[](#update-your-env)

Add your Sendy Access Token token to your `.env` file. And add the Sendy shop UUiD.

```
SENDY_ACCESS_TOKEN="*****"
SENDY_SHOP_ID="*****"
```

To enable the old Keen Delivery API set the following variable to true.

```
KEEN_DELIVERY_LEGACY_ENABLED=true
```

Add your Keen Delivery API token to your `.env` file. You can also add this to your config but this is not advised.

```
KEEN_DELIVERY_API_TOKEN="*****"
```

Usage
-----

[](#usage)

### Add the trait to your model

[](#add-the-trait-to-your-model)

First you need to add the `KeenDelivery` trait to the model which can be shipped.

```
use Marshmallow\KeenDelivery\Traits\KeenDelivery;

class Order
{
    use KeenDelivery;
    // ...
```

### Implement abstract methods

[](#implement-abstract-methods)

Next you need to implement all the methods we need to create a shipment with KeenDelivery. See the example below.

```
use Marshmallow\KeenDelivery\Traits\KeenDelivery;

class Order
{
    use KeenDelivery;

    // ...

    /**
     * Keen Delivery
     */
    public function getDeliveryReference(): string
    {
        return __('Shipment for order: #:order_id', [
            'order_id' => $this->id,
        ]);
    }

    public function getDeliveryCompanyName(): ?string
    {
        return $this->shippingAddress()->company_name;
    }

    public function getDeliveryContactPerson(): ?string
    {
        return $this->shippingAddress()->name;
    }

    public function getDeliveryStreet(): string
    {
        return $this->shippingAddress()->address;
    }

    public function getDeliveryNumber(): string
    {
        return $this->shippingAddress()->house_number;
    }

    public function getDeliveryAddition(): ?string
    {
        return $this->shippingAddress()->house_number_addon;
    }

    public function getDeliveryZipCode(): string
    {
        return $this->shippingAddress()->postal_code;
    }

    public function getDeliveryCity(): string
    {
        return $this->shippingAddress()->city;
    }

    public function getDeliveryCountry(): string
    {
        return $this->shippingAddress()->country?->id ?? 'NL';
    }

    public function getDeliveryPhone(): ?string
    {
        return $this->customer->phone_number;
    }

    public function getDeliveryEmail(): ?string
    {
        return $this->customer->email;
    }

    public function getDeliveryComment(): ?string
    {
        return null;
    }

    public function getDeliveryPredict(): ?string
    {
        return '';
    }

    /**
     * Return the weight in kilo's
     */
    public function getDeliveryWeight(): ?int
    {
        return 1;
    }

    public function getCustomDeliveryData(): array
    {
        return [
            /**
             * Use email notifications for DPD
             */
            'predict' => 2,
        ];
    }
```

### Create a shipment

[](#create-a-shipment)

After you have done this, you can create your shipping labels like so:

```
$order->createShipment()
```

### Events

[](#events)

This package will trigger event on some actions. Below you will find an overview of the events that you can hook in to.

EventWhenVariable\\Marshmallow\\KeenDelivery\\Events\\ShipmentCreatedThis will be triggered everytime a new shipment is created.`$delivery`Use in Laravel Nova
-------------------

[](#use-in-laravel-nova)

If you want to use this package in Nova, you must start by publishing the Nova Resource. This can be done by running the command below. This command will create the file `app\Nova\Delivery.php` if it does not already exist.

[![DeliveryDetail](https://camo.githubusercontent.com/20fc46140de3b49ba96c22e0292e8bf399c7d67600947bd34feafd3b3a1ce1d2/68747470733a2f2f6d617273686d616c6c6f772e6465762f63646e2f726561646d652f6b65656e2d64656c69766572792f44656c697665727944657461696c2e706e67)](https://camo.githubusercontent.com/20fc46140de3b49ba96c22e0292e8bf399c7d67600947bd34feafd3b3a1ce1d2/68747470733a2f2f6d617273686d616c6c6f772e6465762f63646e2f726561646d652f6b65656e2d64656c69766572792f44656c697665727944657461696c2e706e67)

```
php artisan marshmallow:resource Delivery KeenDelivery
```

Update your own resource
------------------------

[](#update-your-own-resource)

In this example, we assume that you want to be able to link your orders to this package. We have a number of useful functions that give you a lot of information and possibilities in Nova. In this example we are talking about orders, however, this can be applied to all your models and resources.

### Show the shipments

[](#show-the-shipments)

Add the relationship below to `App\Nova\Order` to make the shipments visible in the detail view of your orders.

[![DeliveryIndex](https://camo.githubusercontent.com/edbe3592b73243669d7246851ce972a86378401534da0944e8bc391500bbd3d2/68747470733a2f2f6d617273686d616c6c6f772e6465762f63646e2f726561646d652f6b65656e2d64656c69766572792f44656c6976657279496e6465782e706e67)](https://camo.githubusercontent.com/edbe3592b73243669d7246851ce972a86378401534da0944e8bc391500bbd3d2/68747470733a2f2f6d617273686d616c6c6f772e6465762f63646e2f726561646d652f6b65656e2d64656c69766572792f44656c6976657279496e6465782e706e67)

```
public function fields(Request $request)
{
    // ...
    MorphMany::make(__('Deliveries'), 'deliverable', Delivery::class),
}
```

### Show Tracking information on your index

[](#show-tracking-information-on-your-index)

We have created a helper that allows you to add the `Track & Trace` number and a download button to download the shipping label to the index of your resource.

[![OrderIndex](https://camo.githubusercontent.com/7b0718e7995a62bdbc3c9533abf69d2c4b8b6fad487c5c8696839cee831c7428/68747470733a2f2f6d617273686d616c6c6f772e6465762f63646e2f726561646d652f6b65656e2d64656c69766572792f4f72646572496e6465782e706e67)](https://camo.githubusercontent.com/7b0718e7995a62bdbc3c9533abf69d2c4b8b6fad487c5c8696839cee831c7428/68747470733a2f2f6d617273686d616c6c6f772e6465762f63646e2f726561646d652f6b65656e2d64656c69766572792f4f72646572496e6465782e706e67)

```
use Marshmallow\KeenDelivery\Facades\KeenDelivery;

public function fields(Request $request)
{
    // ...
    KeenDelivery::shipmentInfoField(),
}
```

### Filters

[](#filters)

We also have a filter ready by default. With this filter, you can filter on all orders that have been successfully submitted to Keen Delivery. You can also filter on orders that have not yet or not successfully been submitted with Keen Delivery.

[![DeliveryFilters](https://camo.githubusercontent.com/82b0f7f9f8f06549356dc83b2aaecf7e26e078094542b995ffe4678ae5ef6681/68747470733a2f2f6d617273686d616c6c6f772e6465762f63646e2f726561646d652f6b65656e2d64656c69766572792f44656c697665727946696c746572732e706e67)](https://camo.githubusercontent.com/82b0f7f9f8f06549356dc83b2aaecf7e26e078094542b995ffe4678ae5ef6681/68747470733a2f2f6d617273686d616c6c6f772e6465762f63646e2f726561646d652f6b65656e2d64656c69766572792f44656c697665727946696c746572732e706e67)

```
public function filters(Request $request)
{
    return [
        new ShipmentNotifiedFilter,
    ];
}
```

### Actions

[](#actions)

There are two actions in this package that will make your life extra easy.

[![DeliveryActions](https://camo.githubusercontent.com/18e2487fc26cbaf27e82b3e5aaab70b77cdcba47626032b2ba009f27bb5331e6/68747470733a2f2f6d617273686d616c6c6f772e6465762f63646e2f726561646d652f6b65656e2d64656c69766572792f44656c6976657279416374696f6e732e706e67)](https://camo.githubusercontent.com/18e2487fc26cbaf27e82b3e5aaab70b77cdcba47626032b2ba009f27bb5331e6/68747470733a2f2f6d617273686d616c6c6f772e6465762f63646e2f726561646d652f6b65656e2d64656c69766572792f44656c6976657279416374696f6e732e706e67)

#### Submit for shipmet

[](#submit-for-shipmet)

With this action you can submit an order from Nova to Keen Delivery. It is also possible to submit multiple orders at the same time.

```
public function actions(Request $request)
{
    return [
        //
        new SubmitForShipment,
    ];
}
```

#### Download labels

[](#download-labels)

With this action you can download the label of a shipment. It is also possible to download the shipping labels of multiple orders at once.

```
public function actions(Request $request)
{
    return [
        //
        new DownloadLabels,
    ];
}
```

API
---

[](#api)

The following API methods are useful for the setup of this package. With the `verifyApiToken` you can check if you actually have a working connection with the Keen Deliver API and with `listShippingMethods` you can see which shipping methods are available to you.

```
use Marshmallow\KeenDelivery\Facades\KeenDeliveryApi;

KeenDeliveryApi::verifyApiToken();
KeenDeliveryApi::listShippingMethods();
```

Sendy Api
---------

[](#sendy-api)

The following API methods are useful for the setup of this package. With the `me` you can check if you actually have a working connection with the Keen Deliver API and with `listShippingMethods` you can see which shipping methods are available to you. You can also use the 'shops' method to get all the shops that are connected to your account. Or use the `getShopUuid` to get the UUID of the first shop.

```
use Marshmallow\KeenDelivery\Facades\SendyApi;

SendyApi::me();
SendyApi::getShopUuid();
SendyApi::listShops();
SendyApi::getShippingPreference();
SendyApi::listShippingPreferences();
SendyApi::listCarriers();
SendyApi::listShippingMethods();
SendyApi::listServices($carrierId);
SendyApi::getShipment($shipmentId);
```

Carriers
--------

[](#carriers)

The tables below show which carries and which services are currently supported by this package.

DHLDHL\_FOR\_YOU\_MAILBOX\_PACKAGE\_PICK\_UPDHL For You brievenbuspakket (naar particulieren) - Pick-upDHL\_FOR\_YOU\_MAILBOX\_PACKAGE\_DROP\_OFFDHL For You brievenbuspakket (naar particulieren) - Inleveren parcelshopDHL\_EUROPLUS\_PALLETEuroplus Pallet (naar bedrijven)DHL\_EUROPLUS\_PALLET\_INTERNATIONALEuroplus Pallet Internationaal (naar bedrijven)DHL\_EUROPLUS\_PALLET\_RETURNRetour - Europlus Pallet (bij bedrijf op laten halen)DHL\_FOR\_YOU\_DROP\_OFF\_ADDRESSDHL For You (naar particulieren) - Inleveren parcelshopDHL\_EUROPLUS\_DROP\_OFFEuroplus (naar bedrijven) - Inleveren parcelshopDHL\_PARCEL\_CONNECTParcel Connect (naar particulieren en bedrijven)DHL\_PARCEL\_CONNECT\_DROP\_OFFParcel Connect (naar particulieren en bedrijven)DHL\_FOR\_YOU\_DROP\_OFF\_RETURNRetour DHL For You (klant levert in bij Parcelshop)DHL\_FOR\_YOU\_PICK\_UP\_ADDRESSDHL For You (naar particulieren) - Pick-upDHL\_EUROPLUS\_PICK\_UPEuroplus (naar bedrijven) - Pick-upDHL\_EUROPLUS\_INTERNATIONAL\_DROP\_OFFEuroplus Internationaal (naar particulieren en bedrijven)DHL\_EUROPLUS\_INTERNATIONAL\_PICK\_UPEuroplus Internationaal (naar particulieren en bedrijven)DHL\_FOR\_YOU\_PICK\_UP\_PARCELSHOPDHL For You 2Shop (naar Parcelshop)DHL\_FOR\_YOU\_DROP\_OFF\_PARCELSHOPDHL For You 2Shop (naar Parcelshop)DHL\_EXPRESSERExpresser (voor 11.00 uur leveren bij bedrijven)DHL\_FOR\_YOU\_PICK\_UP\_RETURNRetour DHL For You (bij particulier op laten halen)DHL\_EUROPLUS\_RETURNRetour Europlus (bij bedrijf op laten halen)DPDDPD\_HOME\_DROP\_OFFHome (naar particulieren) - InleverenDPD\_HOME\_PICK\_UPHome (naar particulieren) - Pick-upDPD\_CLASSIC\_DROP\_OFFClassic (naar bedrijven) - InleverenDPD\_CLASSIC\_PICK\_UPClassic (naar bedrijven) - Pick-upDPD\_TO\_SHOP\_DROP\_OFF2Shop (naar parcelshop) - InleverenDPD\_TO\_SHOP\_PICK\_UP2Shop (naar parcelshop) - Pick-upDPD\_10\_PICK\_UPDPD 10:00 (voor 10:00 leveren)DPD\_12\_PICK\_UPDPD 12:00 (voor 12:00 leveren)DPD\_18\_PICK\_UPDPD 18:00 (voor 18:00 leveren)DPD\_GUARANTEE\_PICK\_UPDPD Guarantee 18:00DPD\_RETURN\_DROP\_OFFRetour (klant levert in bij parcelshop)DPD\_RETURN\_PICK\_UPRetour (bij klant op laten halen)PostNLPOSTNL\_MPBrievenbuspakje+DOMESTIC\_PACKAGEPakketten NL (naar particulieren &amp; bedrijven)DOMESTIC\_PACKAGE\_MPakketten NL (naar particulieren &amp; bedrijven) - MDOMESTIC\_PACKAGE\_LPakketten NL (naar particulieren &amp; bedrijven) - LDOMESTIC\_PACKAGE\_XLPakketten NL (naar particulieren &amp; bedrijven) - XLTO\_SHOPPakjeGemak (naar PostNL locatie)TO\_SHOP\_MPakjeGemak (naar PostNL locatie) - MTO\_SHOP\_LPakjeGemak (naar PostNL locatie) - LTO\_SHOP\_XLPakjeGemak (naar PostNL locatie) - XLGLOBAL\_PACKPakketten Non-EU (naar particulieren &amp; bedrijven)EPS\_PACKAGE\_CONSUMERPakketten EU (naar particulieren)EPS\_PACKAGE\_BUSINESSPakketten EU (naar bedrijven)DOMESTIC\_PACKAGE\_RETURNRetourpakketten NL (klant levert in bij PostNL locatie)DOMESTIC\_PACKAGE\_RETURN\_MRetourpakketten NL (klant levert in bij PostNL locatie) - MDOMESTIC\_PACKAGE\_RETURN\_LRetourpakketten NL (klant levert in bij PostNL locatie) - LDOMESTIC\_PACKAGE\_RETURN\_XLRetourpakketten NL (klant levert in bij PostNL locatie) - XlTNT48NEconomy ExpressTesting
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

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

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

[](#contributing)

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

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Stef van Esch](https://github.com/stefvanesch)
- [Marshmallow](https://github.com/marshmallow-packages)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

Resources
---------

[](#resources)

API documentation:

---

Copyright (c) 2021 marshmallow.

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance65

Regular maintenance activity

Popularity16

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 64.3% 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 ~142 days

Recently: every ~301 days

Total

11

Last Release

214d ago

Major Versions

v0.2.2 → v2.0.02023-09-06

v2.1.0 → v3.0.02025-10-08

PHP version history (2 changes)v0.0.1PHP ^7.4|^8.0

v0.1.0PHP ^8.0

### Community

Maintainers

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

---

Top Contributors

[![LTKort](https://avatars.githubusercontent.com/u/2412670?v=4)](https://github.com/LTKort "LTKort (18 commits)")[![stefvanesch](https://avatars.githubusercontent.com/u/46725619?v=4)](https://github.com/stefvanesch "stefvanesch (10 commits)")

---

Tags

laravelmarshmallowkeen-delivery

### Embed Badge

![Health badge](/badges/marshmallow-keen-delivery/health.svg)

```
[![Health](https://phpackages.com/badges/marshmallow-keen-delivery/health.svg)](https://phpackages.com/packages/marshmallow-keen-delivery)
```

###  Alternatives

[anchu/ftp

A simple Laravel 7 ftp service provider

225579.4k](/packages/anchu-ftp)[palanik/lumen-cors

Cross-origin resource sharing (CORS) middleware for Lumen micro-framework.

101237.4k](/packages/palanik-lumen-cors)[api-platform/laravel

API Platform support for Laravel

59126.4k6](/packages/api-platform-laravel)[laravel-shift/curl-converter

A command line tool to convert curl requests to Laravel HTTP requests.

935.3k](/packages/laravel-shift-curl-converter)[alfrasc/laravel-matomo-tracker

A Laravel facade/wrapper for the matomo/matomo-php-tracker for server side Matomo tracking.

1923.9k](/packages/alfrasc-laravel-matomo-tracker)[behamin/service-proxy

for proxy or sending requests to other services with useful utilities

102.2k](/packages/behamin-service-proxy)

PHPackages © 2026

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