PHPackages                             smartsendio/api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. smartsendio/api

ActiveLibrary[API Development](/categories/api)

smartsendio/api
===============

API Package for the Smart Send API

v0.2.0(5y ago)03[3 issues](https://github.com/smartsendio/php-sdk/issues)MITPHPPHP ~7.2

Since Jun 5Pushed 5y agoCompare

[ Source](https://github.com/smartsendio/php-sdk)[ Packagist](https://packagist.org/packages/smartsendio/api)[ Docs](https://github.com/smartsendio/api)[ RSS](/packages/smartsendio-api/feed)WikiDiscussions master Synced 4d ago

READMEChangelog (2)Dependencies (4)Versions (4)Used By (0)

Smart Send API
==============

[](#smart-send-api)

[![Latest Version on Packagist](https://camo.githubusercontent.com/674d40c12fa512c9b608bc7870b2939b2136411a9b5e460c5fa3e48d2e3dde19/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f736d61727473656e64696f2f6170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/smartsendio/api)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Tests](https://github.com/smartsendio/php-sdk/workflows/Tests/badge.svg)](https://github.com/smartsendio/php-sdk/workflows/Tests/badge.svg)[![Total Downloads](https://camo.githubusercontent.com/e1c64239fdcae69a23795ff4b72c1e75a53b361e684e8f3a3c533f856ed4b3e4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f736d61727473656e64696f2f6170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/smartsendio/api)

PHP SDK for interacting with the Smart Send API.

Check our [Swagger documentation](https://app.swaggerhub.com/apis/smartsendio/webshop/) for more details.

Install
-------

[](#install)

Via Composer

```
$ composer require smartsendio/api
```

Usage
-----

[](#usage)

Use Composer's autoload:

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

And finally create an instance of the SDK:

```
$client = new Smartsendio\Api\Adapters\GuzzleClientAdapter(new \GuzzleHttp\Client());
$api = new Smartsendio\Api\ApiFactory($client); // Any client that implements ClientInterface can be used
$api->apiToken('API_TOKEN_HERE')->website('WEBSITE'); // Set the authentication parameters
```

### Demo mode

[](#demo-mode)

Demo mode can be used for testing and is activated like so:

```
$api->demo(); // Api is now in demo mode.
```

### Fetching agents

[](#fetching-agents)

Agents are fetched using the `agents` API.

```
// Example: All agents for a given carrier in a zipcode
$response = $api->agents() // AgentApiInterface
    ->carrier('postnord')
    ->country('DK')
    ->zipcode('2100')
    ->get(); // PaginatedAgentApiResponseInterface

// Example: The closest agents for a given carrier based on a given address
$response = $api->agents() // AgentApiInterface
    ->carrier('postnord')
    ->country('DK')
    ->zipcode('2100')
    ->street('Nordre Frihavnsgade 1')
    ->closest(); // PaginatedAgentApiResponseInterface

// Example: Get a single agent using the carries own unique agent number
$response = $api->agents() // AgentApiInterface
    ->carrier('postnord')
    ->country('DK')
    ->lookup('1234567'); // AgentApiResponseInterface
```

### Shipments

[](#shipments)

Booking of shipments (creating shipping labels) are done by firstly creating the complex `Shipment` object and passing that to the `shipments` API:

```
$item = \Smartsendio\Api\Data\Item::make([
   'internal_id' => '000000123',
   'internal_reference' => 'PRODUCT-1231456',
   'sku' => '012345678',
   'name' => 'Product A',
   'description' => 'Small product A',
   'hs_code' => '10203040',
   'country_of_origin' => 'dk',
   'image_url' => 'https://example.com/catalog/product-a.jpg',
   'unit_weight' => 1.2,
   'unit_price_excluding_tax' => 40.6,
   'unit_price_including_tax' => 50.75,
   'quantity' => 2,
   'total_price_excluding_tax' => 81.2,
   'total_price_including_tax' => 101.5,
   'total_tax_amount' => 20.3,
]);

$parcel = \Smartsendio\Api\Data\Parcel::make([
    'internal_id' => '00100025556',
    'internal_reference' => 'ABC12345678',
    'weight' => 9.3,
    'height' => 1,
    'width' => 1,
    'length' => 1,
    'freetext' => 'Please handle this package',
    'total_price_excluding_tax' => 141.2,
    'total_price_including_tax' => 176.5,
    'total_tax_amount' => 35.3,
]);
$parcel->addItem($item);

$shipment = new \Smartsendio\Api\Data\Shipment();
$shipment->setReceiver([
    'internal_id' => '00000158895',
    'internal_reference' => '123456',
    'company' => 'Smart Send',
    'name_line1' => 'Sven',
    'name_line2' => 'Andersson',
    'address_line1' => 'Drottninggatan 75',
    'address_line2' => 'LGH 1102',
    'postal_code' => '46133',
    'city' => 'Trollhøttan',
    'state' => 'AL',
    'country' => 'SE',
    'sms' => '+46851972000',
    'email' => 'email@example.com',
])->addParcel($parcel);

$response = $api->booking()  // BookingApiInterface
    ->shipment($shipment); // BookingApiResponseInterface
```

### Dealing with errors

[](#dealing-with-errors)

This is how to deal with API errors:

```
$response = $api->booking()->shipment($shipment); // ApiResponseInterface
$response->isSuccessful(); // false
$error = $response->getError(); // ApiErrorInterface
$error->getId(); // Unique id of the error
$error->getCode(); // Error code describing the type of error
$error->getMessage(); // Description of the error
$error->getErrors(); // Return each individual error
```

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~9 days

Total

2

Last Release

2160d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/30228841?v=4)[Smart Send](/maintainers/smartsendio)[@smartsendio](https://github.com/smartsendio)

---

Top Contributors

[![bilfeldt](https://avatars.githubusercontent.com/u/30228807?v=4)](https://github.com/bilfeldt "bilfeldt (45 commits)")

---

Tags

apisdkSmartSendSmart SendSmartSendIoSmart Send Io

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/smartsendio-api/health.svg)

```
[![Health](https://phpackages.com/badges/smartsendio-api/health.svg)](https://phpackages.com/packages/smartsendio-api)
```

###  Alternatives

[openai-php/laravel

OpenAI PHP for Laravel is a supercharged PHP API client that allows you to interact with the Open AI API

3.7k7.6M74](/packages/openai-php-laravel)[saloonphp/saloon

Build beautiful API integrations and SDKs with Saloon

2.4k9.6M468](/packages/saloonphp-saloon)[hubspot/api-client

Hubspot API client

23414.2M16](/packages/hubspot-api-client)[php-opencloud/openstack

PHP SDK for OpenStack APIs. Supports BlockStorage, Compute, Identity, Images, Networking and Metric Gnocchi

2292.2M24](/packages/php-opencloud-openstack)[mailchimp/transactional

458.9M16](/packages/mailchimp-transactional)[resend/resend-php

Resend PHP library.

564.7M21](/packages/resend-resend-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
