laravel-orlen-paczka maintained by beziworld
Laravel ORLEN Paczka
ORLEN Paczka (formerly Paczka w RUCHu) API client for Laravel:
- parcel registration with labels (PDF, PDF 10x15, EPL, ZPL), up to 50 parcels per call
- label duplicates, handover protocols and cancellation
- tracking: latest status and full history
- the full list of pickup points and ORLEN lockers
- courier pickups
- SOAP without
ext-soap: requests go through the Laravel HTTP client, so they can be faked in tests
Installation
composer require beziworld/laravel-orlen-paczka
php artisan vendor:publish --tag=orlen-paczka-config # optional
ORLEN_PACZKA_PARTNER_ID=... # issued by an ORLEN Paczka sales representative
ORLEN_PACZKA_PARTNER_KEY=...
ORLEN_PACZKA_SANDBOX=false # true = api-test.orlenpaczka.pl (separate credentials)
ORLEN_PACZKA_LABEL_FORMAT=PDF10 # PDF | PDF10 | EPL | ZPL | ZPL_300DPI
ORLEN_PACZKA_SENDER_EMAIL=shop@acme.pl
ORLEN_PACZKA_SENDER_COMPANY=ACME
ORLEN_PACZKA_SENDER_STREET=Prosta
ORLEN_PACZKA_SENDER_BUILDING_NUMBER=1
ORLEN_PACZKA_SENDER_CITY=Warszawa
ORLEN_PACZKA_SENDER_POST_CODE=00-001
ORLEN_PACZKA_SENDER_PHONE=500600700
Send a parcel
use Beziworld\OrlenPaczka\Data\Contact;
use Beziworld\OrlenPaczka\Data\Parcel;
use Beziworld\OrlenPaczka\Facades\OrlenPaczka;
$shipment = OrlenPaczka::createParcel(new Parcel(
destinationCode: 'XX-142450-00-00', // point or locker chosen by the customer
receiver: new Contact('anna@example.com', '600700800', '30-001', 'Kraków', firstName: 'Anna', lastName: 'Kowalska'),
boxSize: 'M', // S, M or L; required for lockers
senderReference: 'ORDER-1', // printed on the label
));
$parcel = $shipment->parcels[0];
$parcel->packCode; // 13-digit parcel number
$parcel->destinationCode; // final point (it may change, see destinationChanged())
$parcel->trackingUrl();
Storage::put("labels/{$parcel->packCode}.pdf", $shipment->label);
createParcels() registers up to 50 parcels in one call and reports failures per parcel ($shipment->failed())
instead of throwing. Labels are valid for 14 days; parcels not posted in that time are cancelled automatically.
ORLEN Paczka no longer offers cash on delivery or insurance, so the package does not send those fields.
Tracking, points and more
$status = OrlenPaczka::status($parcel->packCode); // TrackingEvent: code, description, occurredAt
$status->isWaitingAtPoint(); // 690
$status->isCollected(); // 1000, 1100, 1200
OrlenPaczka::history($parcel->packCode); // full history, last 90 days
$points = OrlenPaczka::points(); // list<Point>: code, type (APM, PKN, ...), address, coordinates
Cache::put('orlen-points', $points, now()->addDay()); // the list changes daily; refresh after 06:00
OrlenPaczka::labels([$parcel->packCode]); // duplicate labels
OrlenPaczka::protocol([$parcel->packCode]); // handover protocol (PDF)
OrlenPaczka::cancel($parcel->packCode);
$address = new Contact('shop@acme.pl', '500600700', '00-001', 'Warszawa', 'Prosta', '1', firstName: 'Jan', lastName: 'Nowak', companyName: 'ACME');
OrlenPaczka::availablePickups($address, now());
OrlenPaczka::callPickup([$parcel->packCode], $address, readyDate: now(), pickupDate: now()->addHours(4));
Times returned by ORLEN Paczka are Polish local time even though they end with "Z"; the package parses them in Europe/Warsaw.
Errors
The API reports errors through <Err> codes, thrown as ApiException with errorCode() (for example 205 unknown
parcel, 202 cannot be cancelled, 401 invalid credentials) and isTemporary() for 999. SOAP faults, HTTP errors
and connection failures are thrown as ApiException too; missing credentials or sender as InvalidConfiguration.
Development
composer install
composer ci # pint --test, phpstan (level 8), pest
Author
Created and maintained by Kamil Ćwiertnia, beziworld.eu.
- E-mail: biuro@beziworld.eu
- Issues: GitHub issues
Need a shipping integration for your shop? Get in touch through beziworld.eu.
Other packages by the author
laravel-inpost · laravel-dpd · laravel-dhl-parcel · laravel-furgonetka · laravel-apaczka
License
MIT. See LICENSE.md. This package is not affiliated with ORLEN.