PHP code example of mvdnbrk / myparcel-php-api
1. Go to this page and download the library: Download mvdnbrk/myparcel-php-api library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mvdnbrk / myparcel-php-api example snippets
$myparcel->labels->get($shipment->id);
$myparcel->labels->get($shipment);
$myparcel->labels->setFormatA4()->get($shipment);
$servicepoints = $myparcel->servicePoints->setPostalcode('1234AA')->setHousenumber('1')->get();
$servicepoints->each(function ($item) {
$item->id;
$item->name;
$item->latitude;
$item->longitude;
$item->distance;
$item->distanceForHumans();
$item->opening_hours;
});
bash
composer
php
$myparcel = new \Mvdnbrk\MyParcel\Client();
$myparcel->setApiKey('your-api-key');
php
$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',
]
]);
php
$parcel = new \Mvdnbrk\MyParcel\Resources\Parcel([
...
'recipient' => [
...
],
'options' => [
'description' => 'Description on the label',
'signature' => true,
...
],
]);
php
$parcel->labelDescription('Your description.')
->ageCheck()
->onlyRecipient()
->returnToSender()
->signature();
php
$parcel->mailboxpackage();
php
$parcel = new \Mvdnbrk\MyParcel\Resources\Parcel([
'recipient' => [
...
],
'pickup' => [
'name' => 'Name of the location',
'street' => 'Poststraat',
'number' => '1',
'postal_code' => '1234AA',
'city' => 'Amsterdam',
'cc' => 'NL,
]
]);