Red je Pakketje API documentation
Get it with composer
composer require jacobdekeizer/redjepakketje-client
This readme shows basic usage of this package, for all available options see the class definitions and the api documentation.
Create the client
$client = new \JacobDeKeizer\RedJePakketje\Client();
$client->setApiKey('api_key');
$shipment = (new \JacobDeKeizer\RedJePakketje\Resources\Shipment())
->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\Resources\Shipment::PRODUCT_SAME_DAY_PARCEL_STANDARD)
->setReference('reference')
->setNote('my_note')
->setPickUpPoint('pick_up_point_uuid');
$shipmentResponse = $client->shipments()->create(
$shipment,
new \JacobDeKeizer\RedJePakketje\Parameters\Shipments\Create() // optional
);
$label = $shipmentResponse->getLabel();
$shipment->setProductOptions([
(new ProductOption())->setOption(ProductOption::OPTION_ALLOW_NEIGHBOURS)->setValue(true),
(new ProductOption())->setOption(ProductOption::OPTION_REQUIRE_SIGNATURE)->setValue(false),
(new ProductOption())->setOption(ProductOption::OPTION_AGE_CHECK_18)->setValue(false),
(new ProductOption())->setOption(ProductOption::OPTION_PERISHABLE)->setValue(true)->setMaxAttempts(2),
]);
$shipmentsList = $client->shipments()->all(
new \JacobDeKeizer\RedJePakketje\Parameters\Shipments\All() // optional
);
$shipmentResponse = $client->shipments()->get(
'your_tracking_code',
new \JacobDeKeizer\RedJePakketje\Parameters\Shipments\GetLabel() // optional
);
// for example check the shipment status
$isPreTransit = $shipmentResponse->isStatus(\JacobDeKeizer\RedJePakketje\Enums\ShipmentStatus::STATUS_PRE_TRANSIT);
$labelContents = $client->shipments()->getLabel(
'your_tracking_code',
new \JacobDeKeizer\RedJePakketje\Parameters\Shipments\GetLabel() // optional
);
$returnShipment = (new \JacobDeKeizer\RedJePakketje\Resources\ReturnShipment())
->setName('Gijs Boersma')
->setStreet('Lange laan')
->setHouseNumber(29)
->setHouseNumberExtension('a')
->setZipcode('9281EM')
->setCity('Zevenaar')
->setTelephone('0602938172')
->setEmail('[email protected]')
->setReference('Bestelling 112')
->setNote('Some note')
->setReceiverName('My company')
->setPickUpPoint('pick_up_point_uuid')
->setProduct(\JacobDeKeizer\RedJePakketje\Resources\ReturnShipment::PRODUCT_SAME_DAY_PARCEL_STANDARD)
->setNote('some text');
$returnShipmentResponse = $client->returnShipments()->create($returnShipment);
$returnShipmentsList = $client->returnShipments()->all(
new \JacobDeKeizer\RedJePakketje\Parameters\ReturnShipments\All() // optional
);
$returnShipment = $client->returnShipments()->get('return_shipment_uuid');
// for example check the return shipment status
$isPreTransit = $returnShipment->isStatus(\JacobDeKeizer\RedJePakketje\Enums\ReturnShipmentStatus::STATUS_PRE_TRANSIT);
$pickUpPoints = $client->pickUpPoints()->all();
$pickUpPoint = $client->pickUpPoints()->get('pick_up_point_uuid');
$contact = (new \JacobDeKeizer\RedJePakketje\Resources\Contact())
->setFirstName('John')
->setLastName('Doe')
->setEmail('[email protected]')
->setTelephone('+31612345678')
->setGender(\JacobDeKeizer\RedJePakketje\Resources\Contact::GENDER_MALE)
->setReference('reference');
$contactResponse = $client->contacts()->create($contact);
$contacts = $client->contacts()->all();
$contact = $client->contacts()->get('contact_uuid');
$contact = (new \JacobDeKeizer\RedJePakketje\Resources\Contact())
->setUuid('uuid_of_contact')
->setFirstName('Jane')
->setLastName('Doe')
->setEmail('[email protected]')
->setTelephone('+31612345678')
->setGender(\JacobDeKeizer\RedJePakketje\Resources\Contact::GENDER_FEMALE)
->setReference('reference');
$contactResponse = $client->contacts()->update($contact);
$cutOffTime = $client->cutOffTimes()->get('1102AB');
Check: ./vendor/bin/phpcs --standard=PSR2 ./src
Autofix: ./vendor/bin/phpcbf --standard=PSR2 ./src
Check: .\vendor\bin\phpcs --standard=PSR2 ./src
Autofix: .\vendor\bin\phpcbf --standard=PSR2 ./src