WT CDEK for Joomla: PHP library documentation

WT CDEK library - Documentation
Category: Libraries

WT CDEK in WT CDEK for Joomla covers library setup and API integration. This reference explains its purpose, parameters and PHP examples for Joomla extensions.

WT CDEK library is a native Joomla 4.2.7+, Joomla 5 and Joomla 6 integration with CDEK REST API. It supplies the transport layer, OAuth authentication and entity-specific API methods. PHP 7.4 is supported.

Since 1.3.0, use the Webtolk\Cdekapi\Cdek facade to access specialized entities.

Getting started

Enable System - WT Cdek and configure client_id and client_secret. Then create Cdek without arguments:

<?php

declare(strict_types=1);

use Webtolk\Cdekapi\Cdek;

defined('_JEXEC') or die;

$cdek = new Cdek();

To pass credentials explicitly, use positional arguments compatible with PHP 7.4:

<?php

declare(strict_types=1);

use Webtolk\Cdekapi\Cdek;

defined('_JEXEC') or die;

$cdek = new Cdek(
    true,
    'your_client_id',
    'your_client_secret'
);

Reading this documentation

Each entity page explains its purpose, public methods, signatures, REST endpoints, library-side parameter checks, response and a PHP example. The library checks only part of the required data; CDEK performs full business validation. A response can contain error_code and error_message even when the HTTP request was completed.

Response format

Most methods return an array. A successful response follows the endpoint data structure. A normalized error has this form:

[
    'error_code' => 400,
    'error_message' => 'Error text',
]

Automatic behavior

The library selects production/test mode, obtains OAuth tokens, caches them using Joomla, normalizes some API errors and caches selected reference requests, such as tariffs and pickup points.

Joomla Form Fields

Overview and getting started

Entities

WT CDEK 1.4.0 source code on GitHub

WebTolk Joomla Extensions

113 Extensions
12 Categories
587 Versions released
920737 Downloads