PHPackages                             mvdnbrk/myparcel-php-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. mvdnbrk/myparcel-php-api

ActiveLibrary[API Development](/categories/api)

mvdnbrk/myparcel-php-api
========================

MyParcel API client for PHP

v2.3.0(5y ago)25.1k5[3 issues](https://github.com/mvdnbrk/myparcel-php-api/issues)[5 PRs](https://github.com/mvdnbrk/myparcel-php-api/pulls)1MITPHPPHP ^7.3 || ^8.0CI failing

Since Aug 24Pushed 5y ago1 watchersCompare

[ Source](https://github.com/mvdnbrk/myparcel-php-api)[ Packagist](https://packagist.org/packages/mvdnbrk/myparcel-php-api)[ Docs](https://github.com/mvdnbrk/myparcel-php-api)[ GitHub Sponsors](https://github.com/mvdnbrk)[ RSS](/packages/mvdnbrk-myparcel-php-api/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (10)Dependencies (6)Versions (30)Used By (1)

MyParcel API client for PHP
===========================

[](#myparcel-api-client-for-php)

[![PHP version](https://camo.githubusercontent.com/c4727da03b08d8648743bc0a9195fb0b1d878dbc2f4782125db70d48001326b9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6d76646e62726b2f6d7970617263656c2d7068702d6170693f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/c4727da03b08d8648743bc0a9195fb0b1d878dbc2f4782125db70d48001326b9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6d76646e62726b2f6d7970617263656c2d7068702d6170693f7374796c653d666c61742d737175617265)[![Latest Version on Packagist](https://camo.githubusercontent.com/24dbe1472275d37de66049a4e9ecb624935c605b9496af881dbaaa369f097716/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d76646e62726b2f6d7970617263656c2d7068702d6170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mvdnbrk/myparcel-php-api)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Tests](https://camo.githubusercontent.com/7f005058ae97e5a3ce9b6907fb1c4ec9f40b40086fa114406171e102f25896b9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f6d76646e62726b2f6d7970617263656c2d7068702d6170692f74657374732f6d61696e3f6c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/mvdnbrk/myparcel-php-api/actions?query=workflow%3Atests)[![StyleCI](https://camo.githubusercontent.com/0e1e29f1b07e2c5d630e186183a19f1c2ffc3334f23dbedfdc823f4a06160c40/68747470733a2f2f7374796c6563692e696f2f7265706f732f37323239323336342f736869656c643f6272616e63683d6d61696e)](https://styleci.io/repos/72292364)[![Total Downloads](https://camo.githubusercontent.com/fd3e3080b133a0742258059e6c65c2cd7a26e5d8938cba4ef18bd4a2d00de84e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d76646e62726b2f6d7970617263656c2d7068702d6170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mvdnbrk/myparcel-php-api)

[MyParcel](https://www.myparcel.nl) makes sending packages easy.

[MyParcel API documentation](https://myparcelnl.github.io/api/)

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

[](#requirements)

To use the MyParcel API client, the following things are required:

- Get a free [MyParcel account](https://backoffice.myparcel.nl/registration)
- Generate your [API Key](https://backoffice.myparcel.nl/settings)
- Now you're ready to use the MyParcel API client

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

[](#installation)

You can install the package via composer:

```
composer require mvdnbrk/myparcel-php-api
```

Getting started
---------------

[](#getting-started)

Initialize the MyParcel client and set your API key:

```
$myparcel = new \Mvdnbrk\MyParcel\Client();

$myparcel->setApiKey('your-api-key');
```

### Create a parcel

[](#create-a-parcel)

```
$parcel = new \Mvdnbrk\MyParcel\Resources\Parcel([
    'reference' => 'your own reference for the parcel',
    'recipient' => [
        'first_name' => 'John',
        'last_name' => 'Doe'
        'street' => 'Poststraat',
        'number' => '1',
        'number_suffix' => 'A',
        'postal_code' => '1234AA',
        'city' => 'Amsterdam',
        'cc' => 'NL',
    ]
]);
```

### Create a shipment

[](#create-a-shipment)

```
$shipment = $myparcel->shipments->create($parcel);

// Get the `id` of the shipment. You may save this value for later reference.
$shipment->id;
```

You have created your first shipment!

### Retrieve a label

[](#retrieve-a-label)

A label can be retrieved by using `$shipment->id`. This will return a label in A6 format as a string.

```
$myparcel->labels->get($shipment->id);
```

Or you may pass the `Shipment` instance directly to this method:

```
$myparcel->labels->get($shipment);
```

The label format is A6 by default, you may change this by calling the `setFormatA4` method:

```
$myparcel->labels->setFormatA4()->get($shipment);
```

### Setting delivery options for a parcel

[](#setting-delivery-options-for-a-parcel)

You can set delivery options for a parcel by passing in the options directly when you create a parcel:

```
$parcel = new \Mvdnbrk\MyParcel\Resources\Parcel([
    ...
    'recipient' => [
        ...
    ],
    'options' => [
        'description' => 'Description on the label',
        'signature' => true,
        ...
    ],
]);
```

Or you may use a method like `signature`, `onlyRecipient`, `returnToSender`, `ageCheck` and `labelDescription`. You may call any of these methods after constructing the parcel:

```
$parcel->labelDescription('Your description.')
       ->ageCheck()
       ->onlyRecipient()
       ->returnToSender()
       ->signature();
```

**Mailbox package**

This package type is only available for shipments in the Netherlands that fit in a standard mailbox.

```
$parcel->mailboxpackage();
```

### Send a parcel to a service point

[](#send-a-parcel-to-a-service-point)

You may send a parcel to a PostNL service point where a customer can pick up the parcel:

```
$parcel = new \Mvdnbrk\MyParcel\Resources\Parcel([
    'recipient' => [
        ...
    ],
    'pickup' => [
        'name' => 'Name of the location',
        'street' => 'Poststraat',
        'number' => '1',
        'postal_code' => '1234AA',
        'city' => 'Amsterdam',
        'cc' => 'NL,
    ]
]);
```

### Retrieve service points

[](#retrieve-service-points)

```
$servicepoints = $myparcel->servicePoints->setPostalcode('1234AA')->setHousenumber('1')->get();
```

This will return a collection of `ServicePoint` objects:

```
$servicepoints->each(function ($item) {
    $item->id;
    $item->name;
    $item->latitude;
    $item->longitude;
    $item->distance;
    $item->distanceForHumans();
    $item->opening_hours;
});
```

### Get a shipment

[](#get-a-shipment)

You can get a shipment by `id` or your own reference.

```
$shipment = $myparcel->shipments->get($id);

$shipment = $myparcel->shipments->getByReference('your own reference');

// Get the barcode for the shipment:
$shipment->barcode;

// Get the current status:
$shipment->status;
```

### Track a shipment

[](#track-a-shipment)

You can get detailed track and trace information for a shipment.

```
$tracktrace = $myparcel->tracktrace->get($id);

// Links:
$tracktrace->link;
$tracktrace->link_portal;

// Check if the shipment is delivered:
$tracktrace->isDelivered;

// Get current state of the shipment:
$tracktrace->code;
$tracktrace->description;
$tracktrace->datetime;

// Get all traces for the shipment, this will return a collection with
// all traces in descending order, including the current state:
$tracktrace->items;

// Convert all items to an array:
$tracktrace->items->all()
```

Usage with Laravel
------------------

[](#usage-with-laravel)

You may incorporate this package in your Laravel application by using [this package](https://github.com/mvdnbrk/laravel-dhlparcel).

Changelog
---------

[](#changelog)

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

Testing
-------

[](#testing)

```
$ composer test
```

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)

- [Mark van den Broek](https://github.com/mvdnbrk)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity78

Established project with proven stability

 Bus Factor1

Top contributor holds 99% 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 ~30 days

Recently: every ~43 days

Total

29

Last Release

2013d ago

Major Versions

v0.9.2 → v1.0.02019-04-26

v1.0.2 → v2.0.02019-11-15

PHP version history (4 changes)v0.1.0PHP &gt;=7.0

v0.6.2PHP ^7.1

v2.0.0PHP ^7.2

v2.2.0PHP ^7.3 || ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/802681?v=4)[Mark van den Broek](/maintainers/mvdnbrk)[@mvdnbrk](https://github.com/mvdnbrk)

---

Top Contributors

[![mvdnbrk](https://avatars.githubusercontent.com/u/802681?v=4)](https://github.com/mvdnbrk "mvdnbrk (500 commits)")[![avido](https://avatars.githubusercontent.com/u/14986?v=4)](https://github.com/avido "avido (2 commits)")[![it-can](https://avatars.githubusercontent.com/u/644288?v=4)](https://github.com/it-can "it-can (2 commits)")[![ZenoWebdev](https://avatars.githubusercontent.com/u/62022953?v=4)](https://github.com/ZenoWebdev "ZenoWebdev (1 commits)")

---

Tags

apimyparcelphppostnlphpapipostnlmyparcel

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mvdnbrk-myparcel-php-api/health.svg)

```
[![Health](https://phpackages.com/badges/mvdnbrk-myparcel-php-api/health.svg)](https://phpackages.com/packages/mvdnbrk-myparcel-php-api)
```

###  Alternatives

[theodo-group/llphant

LLPhant is a library to help you build Generative AI applications.

1.7k371.6k6](/packages/theodo-group-llphant)[hubspot/api-client

Hubspot API client

24015.5M18](/packages/hubspot-api-client)[resend/resend-php

Resend PHP library.

596.2M35](/packages/resend-resend-php)[checkout/checkout-sdk-php

Checkout.com SDK for PHP

563.5M10](/packages/checkout-checkout-sdk-php)[mozex/anthropic-laravel

Laravel integration for the Anthropic API: facade, config publishing, install command, testing fakes, messages, streaming, tool use, thinking, and batches.

72287.1k1](/packages/mozex-anthropic-laravel)[clicksend/clicksend-php

301.6M11](/packages/clicksend-clicksend-php)

PHPackages © 2026

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