Download the PHP package ux2dev/speedy without Composer
On this page you can find all versions of the php package ux2dev/speedy. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ux2dev/speedy
More information about ux2dev/speedy
Files in ux2dev/speedy
Package speedy
Short Description Framework-agnostic PHP SDK for Speedy courier (api.speedy.bg)
License MIT
Informations about the package speedy
Speedy PHP SDK
Warning: Developer testing version of the library — use at your own risk.
Framework-agnostic PHP SDK for the Speedy courier API at https://api.speedy.bg/v1. Covers all ten Speedy service groups (Shipment, Print, Track, Pickup, Location, Calculate, Client, Validation, Services, Payments) as resource methods that return typed Response DTOs. Works with plain PHP or Laravel.
Requirements
- PHP 8.2 or higher
- JSON extension
- A PSR-18 HTTP client and PSR-17 request/stream factories (Guzzle provides both)
Installation
Quick start — plain PHP
Quick start — Laravel
The package auto-registers SpeedyServiceProvider and a Speedy facade.
Publish the config:
Set credentials in .env:
Use the facade:
Multiple accounts
account() returns an immutable clone — the default stays untouched.
How the SDK is organised
| Layer | Location | Purpose |
|---|---|---|
| Config | Ux2Dev\Speedy\Config\SpeedyConfig |
Base URL + credentials, validated, password redacted |
| Transport | Ux2Dev\Speedy\Http\SpeedyTransport |
PSR-18 dispatch, auth auto-injection, error mapping |
| Request DTOs | Ux2Dev\Speedy\Dto\Request\{Group}\*Request |
Generated, toArray() |
| Response DTOs | Ux2Dev\Speedy\Dto\Response\{Group}\*Response |
Generated, fromArray() |
| Model DTOs | Ux2Dev\Speedy\Dto\Model\* |
Shared entities (Address, Office, Site, ...) |
| Resources | Ux2Dev\Speedy\Resources\{Group} |
Generated, one method per operation |
| Root client | Ux2Dev\Speedy\Speedy |
Aggregator |
| Laravel | Ux2Dev\Speedy\Laravel\* |
Service Provider + multi-account Manager + Facade |
Generated from bin/endpoints.json (a hand-curated catalog of 45 operations) plus bin/schemas/ (a snapshot of https://api.speedy.bg/v1/schema) by bin/generate.php.
Resources
10 generated resource groups, mirroring Speedy's service organisation:
Every resource method takes a Request DTO plus optional $language and $clientSystemId overrides, and returns a typed Response DTO:
Print Service
Print endpoints currently follow Speedy's documented JSON envelope (PrintVoucherResponse carries the PDF as a pdf byte-array). When you need the binary path directly, the SDK exposes Ux2Dev\Speedy\Http\PrintResult with body, contentType, filename, plus bytes(), saveTo($path), isPdf(), and isZpl() helpers.
Errors
Successful return paths always carry a "good" Response DTO. When the API responds with a populated error field, the transport throws Ux2Dev\Speedy\Exception\ApiException with structured fields (apiCode, apiMessage, context, errorId, component, httpStatus). The raw response body is intentionally not retained on the exception — the structured fields cover every documented error attribute, and dropping the body avoids leaking PII or credentials into logs and traces.
| Exception | When |
|---|---|
ConfigurationException |
Invalid SpeedyConfig input or unknown Laravel account |
TransportException |
PSR-18 client failure (network, timeout) |
InvalidResponseException |
Empty body, malformed JSON, or unexpected envelope |
ApiException |
Speedy returned a non-null error field |
All extend SpeedyException.
Regenerating the SDK
Testing
The suite mocks a PSR-18 client to exercise every resource method end-to-end.
License
MIT
All versions of speedy with dependencies
ext-json Version *
psr/http-client Version ^1.0
psr/http-factory Version ^1.0