# Quick start

The fastest path to a first shipment uses the official
[PHP SDK](/sdk). Integrating from another language? Follow
[Request signing (HMAC)](/legacy/hmac-signing) and the
[cURL examples](/legacy/implementation-examples) instead — the flow below is
the same.

## 1. Get API credentials

Log in to the [Apaczka panel](https://panel.apaczka.pl) and create an API
application under **Settings → API**. You get an `app_id` and an
`app_secret` — keep the secret server-side.

## 2. Install the SDK

```bash
composer require alsendo/alsendo-one-sdk guzzlehttp/guzzle guzzlehttp/psr7
```

## 3. Pick a service

List the carrier services available on your account —
[don't hardcode them](/guides/best-practices#dont-hardcode-carriers-and-services):

```php
<?php
require __DIR__ . '/vendor/autoload.php';

use AlsendoOne\SDK\AlsendoClient;

$client = new AlsendoClient('your_app_id', 'your_app_secret');

foreach ($client->getServiceStructure()->getServices() as $service) {
    echo $service['service_id'] . ': ' . $service['name'] . PHP_EOL;
}
```

## 4. Price and create an order

```php
use AlsendoOne\SDK\DTO\Address;
use AlsendoOne\SDK\DTO\Request\OrderRequest;
use AlsendoOne\SDK\DTO\Request\PickupRequest;
use AlsendoOne\SDK\DTO\Request\ShipmentRequest;
use AlsendoOne\SDK\Type\Service;

$order = OrderRequest::create()
    ->setService(Service::from(Service::DpdCourier)) // from step 3
    ->setSenderAddress(new Address(
        'Firma Sp. z o.o.', 'Jan Kowalski', 'jan@example.com', '500100200',
        'Marszalkowska 1/10', null, '00-001', 'Warszawa', 'PL'
    ))
    ->setReceiverAddress(new Address(
        'Anna Nowak', null, 'anna@example.com', '600300400',
        'Dluga 15', null, '80-831', 'Gdansk', 'PL'
    ))
    ->addShipment(new ShipmentRequest('PACZKA', 2.5, 40, 30, 20)) // kg, cm
    ->setPickup(new PickupRequest('COURIER', date('Y-m-d', strtotime('+1 day')), '10:00', '16:00'));

// Price it first — prices come back in groszy (1 PLN = 100 gr)
$valuation = $client->getValuation($order);

// Create the order
$created = $client->sendOrder($order);

echo 'Order ' . $created->getId() . ', waybill ' . $created->getWaybillNumber();
```

## 5. Download the label

```php
$waybill = $client->getWaybill($created->getId());

file_put_contents('label.pdf', base64_decode($waybill->getWaybill()));
```

Done — the parcel is ordered and the label is on disk.

## Next steps

- The full flow, including documents and cancellation:
  [Order lifecycle](/guides/order-lifecycle)
- Courier pickup vs. drop-off: [Pickup types](/guides/pickups)
- Status updates: [Tracking](/guides/tracking)
- Develop against the [sandbox](/guides/testing) before going live, and read
  the [best practices](/guides/best-practices)
