dicr/yii2-c6v

API доставки c6v.ru для Yii2

Installs: 19

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Forks: 0

Type:yii2-extension

1.0.3 2020-08-31 00:30 UTC

This package is auto-updated.

Last update: 2024-03-29 04:25:50 UTC


README

Настройка

В конфиге нужно настроить компонент:

'components' => [
    'c6v' => [
        'class' => dicr\c6v\C6VApi::class,
        'key' => 'ваш ключ API'
    ]
];          

Использование

/** @var C6VApi $api */
$api = Yii::$app->c6v;

// получение списка городов
$cities = $api->getCities();

// город по индексу
$city = $api->getCityFromIndex(614000);

// расчет доставки
$data = $api->getPrice([
    'startCity' => 'Москва',
    'endCity' => 'Пермь',
    'weight' => 1,
    'width' => 20,
    'height' => 5,
    'length' => 15
]);

// и т.д. и т.п....