PHP code example of jacobdekeizer / redjepakketje-client
1. Go to this page and download the library: Download jacobdekeizer/redjepakketje-client 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/ */
jacobdekeizer / redjepakketje-client example snippets
$client = new \JacobDeKeizer\RedJePakketje\Client();
$client->setApiKey('api_key');
$shipmentsList = $client->shipments()->all(
new \JacobDeKeizer\RedJePakketje\Parameters\Shipments\All() // optional
);
$shipment = $client->shipments()->get('tracking_code');
// for example check the shipment status
$isDelivered = $shipment->getStatus() === \JacobDeKeizer\RedJePakketje\Models\Shipment\Enums\ShipmentStatus::DELIVERED;
$shipment = (new \JacobDeKeizer\RedJePakketje\Models\Shipment\CreateShipment())
->setCompanyName('Boeren BV')
->setName('Gijs Boersma')
->setStreet('Lange laan')
->setHouseNumber(29)
->setHouseNumberExtension('a')
->setZipcode('9281EM')
->setCity('Zevenaar')
->setTelephone('0602938172')
->setEmail('[email protected]')
->setNote('Some note')
->setDeliveryDate(date('Y-m-d'))
->setProduct(\JacobDeKeizer\RedJePakketje\Models\Shipment\Enums\ShipmentProduct::SAME_DAY_PARCEL_STANDARD)
->setReference('reference')
->setNote('my_note')
->setSender('sender_uuid');
// optionally set product options
$shipment->setProductOptions(
(new \JacobDeKeizer\RedJePakketje\Models\Shipment\ProductOption())
->setOption(\JacobDeKeizer\RedJePakketje\Models\Shipment\ProductOption::OPTION_ALLOW_NEIGHBOURS)
->setValue(true),
(new \JacobDeKeizer\RedJePakketje\Models\Shipment\ProductOption())
->setOption(\JacobDeKeizer\RedJePakketje\Models\Shipment\ProductOption::OPTION_REQUIRE_SIGNATURE)
->setValue(false),
(new \JacobDeKeizer\RedJePakketje\Models\Shipment\ProductOption())
->setOption(\JacobDeKeizer\RedJePakketje\Models\Shipment\ProductOption::OPTION_AGE_CHECK_18)
->setValue(false),
(new \JacobDeKeizer\RedJePakketje\Models\Shipment\ProductOption())
->setOption(\JacobDeKeizer\RedJePakketje\Models\Shipment\ProductOption::OPTION_ALLOW_NEIGHBOURS)
->setValue(true)
->setMaxAttempts(2)
);
$shipmentResponse = $client->shipments()->create(
$shipment,
new \JacobDeKeizer\RedJePakketje\Parameters\Shipments\Create() // optional
);
$label = $shipmentResponse->getLabel();
$shipment = $client->shipments()->update(
'tracking_code',
(new \JacobDeKeizer\RedJePakketje\Models\Shipment\UpdateShipment())
->setProduct(\JacobDeKeizer\RedJePakketje\Models\Shipment\Enums\ShipmentProduct::NEXT_DAY_PARCEL_LARGE)
);