1. Go to this page and download the library: Download myparcelnl/sdk 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/ */
myparcelnl / sdk example snippets
use MyParcelNL\Sdk\Collection\ShipmentCollection;
use MyParcelNL\Sdk\Model\Shipment\Shipment;
use MyParcelNL\Sdk\Services\Shipment\ShipmentCreateService;
// Build a shipment
$shipment = (new Shipment())
->setRecipient([
'cc' => 'NL',
'street' => 'Antareslaan',
'number' => 31,
'person' => 'John Doe',
'city' => 'Hoofddorp',
'postal_code' => '2132 JE',
])
->setCarrier(1)
->withPackageType('PACKAGE');
// Create it
$service = new ShipmentCreateService('your-api-key');
$mapping = $service->create((new ShipmentCollection())->push($shipment));
// $mapping = [shipmentId => referenceIdentifier, ...]
$expiresAt = $connect->getRefreshTokenExpiresAt();
if (null !== $expiresAt && $expiresAt < new DateTimeImmutable('+1 month')) {
// Show the reconnect notice.
}