Download the PHP package vegas0250/cdeker without Composer
On this page you can find all versions of the php package vegas0250/cdeker. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package cdeker
cdeker
English · 中文
Minimal PHP client for the CDEK API v2 delivery service. One class, no dependencies.
Features
- Any API v2 endpoint via
get(),post(),patch(),delete(),request()— you pass the path and parameters from the CDEK docs. - OAuth token is obtained and cached automatically (per environment and account), refreshed on expiry or
401. - Errors are thrown as
CdekerExceptionwith the HTTP status and CDEKerrorslist.
Requirements
- PHP >= 5.6 with
ext-jsonandext-openssl allow_url_fopen = On(requests use PHP streams, no cURL/Guzzle)
Installation
Quick start
API
| Method | Description |
|---|---|
new Client($account, $securePassword, $isTest = false) |
$isTest = true uses https://api.edu.cdek.ru |
get($path, array $params = []) |
GET, $params → query string; returns decoded JSON array |
post($path, array $params = []) |
POST, $params → JSON body; returns decoded JSON array |
patch($path, array $params = []) |
PATCH, $params → JSON body; returns decoded JSON array |
delete($path, array $params = []) |
DELETE, $params → query string; returns decoded JSON array |
request($path, $method = Client::METHOD_GET, array $params = []) |
METHOD_GET, METHOD_POST, METHOD_PATCH, METHOD_DELETE |
getTokenNew() |
Current access token (cached) |
Non-JSON success responses (receipt PDFs, barcodes) are returned as a raw string. getErrors() merges top-level errors and requests[].errors.
Token cache
The token is stored in sys_get_temp_dir() as cdeker-token-<hash>.json (mode 0600), one file per environment + account. It is renewed 60 s before expiry; on 401 the cache is cleared and the request retried once.
Upgrading from 1.x to 2.0
1.x returned false on any error. 2.0 throws CdekerException instead — replace === false checks with try/catch.
License
MIT
All versions of cdeker with dependencies
ext-json Version *