Download the PHP package sarissaops/enviatodo-php without Composer
On this page you can find all versions of the php package sarissaops/enviatodo-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download sarissaops/enviatodo-php
More information about sarissaops/enviatodo-php
Files in sarissaops/enviatodo-php
Package enviatodo-php
Short Description Framework-agnostic PSR-18 client for the Enviatodo Shipping API.
License MIT
Informations about the package enviatodo-php
Enviatodo PHP SDK
A clean, framework-agnostic PSR-18 HTTP client wrapper around the Enviatodo Shipping API (V2) — quotes, orders, labels, pickups, addresses, packages, carriers and catalogs for shipping inside Mexico.
The SDK is not coupled to any specific HTTP library. Bring your own PSR-18 client (e.g. symfony/http-client, guzzlehttp/guzzle) and PSR-7/PSR-17 implementation (e.g. nyholm/psr7); auto-discovery configures them for you.
Table of Contents
- Requirements
- Installation
- Quick Start
- Balance
- Postal Codes
- Usage
- Response Handling
- Debugging
- Framework Integration
- Contributing
Requirements
- PHP 8.2 or higher
- A PSR-18 HTTP client (e.g.
symfony/http-client,guzzlehttp/guzzle) - A PSR-7 / PSR-17 implementation (e.g.
nyholm/psr7) - An Enviatodo API token (sandbox tokens work against the QA endpoint below)
Installation
Quick Start
Every request carries Authorization: Bearer <token> plus x-api-key: enviatodo and x-enviatodo-app: custom automatically. Prefer a custom PSR-18 client or factories? Inject them:
Balance
Check the account balance:
Postal Codes
Look up a postal code:
Usage
One method per API operation across 10 domains — address(), package(), parcel(), quote(), order(), guide(), pickup(), catalog() (plus balance() and zipCode() above). Full per-resource recipes live in doc/errors.md.
Response Handling
All API methods return typed model objects with IDE-friendly getters by default. The Enviatodo envelope ({success, message, data, error, code}) is unwrapped for you — and error: true raises even on HTTP 200, since this API can fail inside a 200 response:
Array responses
Prefer raw arrays? Inject ArrayHydrator:
Raw PSR-7 response
Need the raw response? Use NoopHydrator — note: no exceptions are thrown on error responses when using this hydrator.
Debugging
Point the client at a request bin and dump traffic with the raw hydrator:
Framework Integration
The package is framework-free by design: it only needs any PSR-18 client. It stays portable across Symfony, Laravel, WooCommerce and plain CLI scripts.
| Backend | Install |
|---|---|
| Symfony HttpClient | composer require symfony/http-client |
| Guzzle | composer require php-http/guzzle7-adapter guzzlehttp/guzzle |
| PSR-7/PSR-17 factory | composer require nyholm/psr7 |
Symfony bundle live in follow-up package sarissaops/enviatodo-bundle.
Contributing
TDD is mandatory: Red → Green → Refactor. Every endpoint ships as Api\*Api + Model/ value object + facade method + tests/Api + tests/Model.
Sandbox runs need a token without hardcoding one: copy .env.example to .env and set ENVIATODO_TOKEN (see doc/testing.md). Integration tests read it from the environment and are skipped without it; mutating tests live behind --group=mutating and never run by default.
All versions of enviatodo-php with dependencies
php-http/client-common Version ^2.2.1
php-http/discovery Version ^1.19
psr/http-client Version ^1.0
psr/http-message Version ^1.0 || ^2.0
webmozart/assert Version ^1.9.1 || ^2.0