New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

smart-dato/brt

BRT Laravel sdk
9,951
Install
composer require smart-dato/brt
Latest Version:0.0.5
PHP:^8.2|^8.5
Laravel:10 – 13
License:MIT
Last Updated:Oct 14, 2026
Links: GitHub  ·  Packagist
Maintainer: smart-dato

BRT Laravel SDK

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

A Laravel package for integrating with the BRT (Bartolini) courier API, built on Saloon.

Installation

composer require smart-dato/brt

Publish the config file:

php artisan vendor:publish --tag="brt-config"

This is the contents of the published config file:

return [
    'base_url' => env('BRT_BASE_URL', 'https://api.brt.it/orm'),
    'api_key' => env('BRT_API_KEY'),
];

Add your API key to .env:

BRT_API_KEY=your-api-key

Usage

Create a pickup request

use SmartDato\Brt\BrtConnector;
use SmartDato\Brt\Enums\PayerType;
use SmartDato\Brt\Enums\Stakeholder\Type;
use SmartDato\Brt\Requests\Pickup\Create\CreatePickupRequest;
use SmartDato\Brt\ValueObjects\BrtSpecifics;
use SmartDato\Brt\ValueObjects\CollectionRequest;
use SmartDato\Brt\ValueObjects\CustomerInfos;
use SmartDato\Brt\ValueObjects\OpeningHour;
use SmartDato\Brt\ValueObjects\RequestInfos;
use SmartDato\Brt\ValueObjects\Stakeholder\Contact;
use SmartDato\Brt\ValueObjects\Stakeholder\ContactDetails;
use SmartDato\Brt\ValueObjects\Stakeholder\Customer;
use SmartDato\Brt\ValueObjects\Stakeholder\Stakeholder;

$connector = new BrtConnector();

$response = $connector->send(
    new CreatePickupRequest([
        new CollectionRequest(
            requestInfos: new RequestInfos(
                collectionDate: now()->nextWeekday(),
                parcelCount: 1,
            ),
            customerInfos: new CustomerInfos(
                custAccNumber: '0000000',
            ),
            stakeholders: [
                new Stakeholder(
                    type: Type::Requester,
                    customerInfos: new Customer(
                        custAccNumber: '0000000000',
                    ),
                ),
                new Stakeholder(
                    type: Type::Sender,
                    customerInfos: new Customer(
                        custAccNumber: '0000000000',
                    ),
                    contact: new Contact(
                        contactDetails: new ContactDetails(
                            phone: '0000000000',
                            contactPerson: 'John Doe',
                        ),
                    ),
                ),
            ],
            brtSpec: new BrtSpecifics(
                collectionTime: '11:00',
                goodDescription: 'Package description',
                payerType: PayerType::Ordering,
                weightKG: 2.3,
                openingHours: [
                    new OpeningHour(from: '10:00', to: '13:00'),
                    new OpeningHour(from: '15:00', to: '17:00'),
                ],
            ),
        ),
    ])
);

$data = $response->json();

Search pickup requests

use SmartDato\Brt\BrtConnector;
use SmartDato\Brt\Enums\Sort;
use SmartDato\Brt\Requests\Pickup\Search\SearchPickupRequest;

$connector = new BrtConnector();

$response = $connector->send(
    new SearchPickupRequest(
        limit: 10,
        offset: 0,
        sort: Sort::DESC,
    )
);

Get pickup details

use SmartDato\Brt\Requests\Pickup\Search\DetailPickupRequest;

$response = $connector->send(new DetailPickupRequest(id: '123456'));

Count pickup requests

use SmartDato\Brt\Requests\Pickup\Search\CountPickupRequest;

$response = $connector->send(new CountPickupRequest());

Cancel a pickup

use SmartDato\Brt\Requests\Pickup\Cancellation\CancelPickupRequest;

$response = $connector->send(new CancelPickupRequest(id: '123456'));

Update a pickup

use SmartDato\Brt\Requests\Pickup\Edit\UpdatePickupRequest;

$response = $connector->send(new UpdatePickupRequest(id: '123456'));

Using a custom API key

You can pass a token directly to the connector instead of using the config:

$connector = new BrtConnector(token: 'your-api-key');

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

Related Packages

smart-dato/desk365-sdk

Desk365 Laravel SDK - A Laravel package to interact with the Desk365 API.

10,139 0
smart-dato/dpd-sdk

A Laravel package for integrating with the DPD shipping service API.

10,085 0
smart-dato/eushipments

EuShipments Laravel SDK

9,048 0
smart-dato/duty-refunds-landmark

Duty Refunds Landmark API SDK for Laravel

10,033 0

Version History

Version Released PHP Laravel License
0.0.5 ^8.2|^8.5 ^10.0||^11.0||^12.0||^13.0 MIT
0.0.4 ^8.2 ^10.0||^11.0||^12.0 MIT
0.0.3 ^8.2 ^10.0||^11.0||^12.0 MIT
0.0.2 ^8.2 ^10.0||^11.0||^12.0 MIT
0.0.1 ^8.2 ^10.0||^11.0||^12.0 MIT