riesenia/kurier123

123Kurier API PHP client implementation

dev-main 2022-05-10 06:59 UTC

This package is auto-updated.

Last update: 2024-11-10 13:01:54 UTC


README

123Kurier API client implemetation. See 123Kurier official API documentation for details.

Installation

Install the latest version using composer require riesenia/kurier123

Usage

Create API with username and password

use Riesenia\Kurier123\Api;

$api = new Api($username, $password);

Create shipment

$data = [
    'clientOrderNumber' => 12345678,
    'sender' => [
        'id' => 1 
    ],
    'recipient' => [
        'name' => 'John Doe',
        'street' => 'Foo',
        'city' => 'Bar',
        ...
    ],
    ...
];

if (!$api->createShipment($shipment)) {
    echo $api->getErrors();
}

Print shipment labels

$data = [
    // Order numbers
    '60221080912166',
    '60221080912167'
];

$data = $api->generateTickets($data, 'A4');

if (!$data) {
    echo $api->getErrors();
}

Get order status history

$data = [
    // Order numbers
    '60221080912166',
    '60221080912167'
];

$history = $api->statusHistory($data);

if (!$history) {
    echo $api->getErrors();
}