A simple Object Oriented wrapper for iiko API, written with PHP.
Uses iiko API v0.
- Light and fast thanks to lazy loading of API classes
- PHP >= 7.2
Via Composer:
$ composer require andriymiz/iiko-biz-api
In Laravel:
Publish config file
$ php artisan vendor:publish --provider="Iiko\Biz\IikoBizServiceProvider"
Or in .env file
IIKO_BIZ_API_BASE_URI=https://iiko.biz:9900/api/0/
IIKO_BIZ_USER_ID=demoDelivery
IIKO_BIZ_USER_SECRET=PI1yFaKFCGvvJKi
<?php
use Iiko\Biz\Client as IikoClient;
$iiko = new IikoClient([
'user_id' => 'demoDelivery',
'user_secret' => 'PI1yFaKFCGvvJKi',
]);
// Logging in Laravel. Must be set before first call app('iiko');
config(['iiko-biz.logging' => storage_path('logs/iiko.log')]);
// In Laravel;
$iiko = app('iiko');
$organization = $iiko->OrganizationsApi()->getList()[0];
$menu = $iiko->NomenclatureApi()->getMenu($organization['id']);
$canCreateOrder = $iiko->OrdersApi()->checkAddress($organization['id'], [
"city" => "Москва",
"street" => "Планетарная",
"home" => "1"
]);
$cities = $iiko->CitiesApi()->getCitiesWithStreets($organization['id']);
$order = $iiko->OrdersApi()->addOrder([
'organization' => $organization['id'],
'customer' => ['name' => 'test', 'phone' => 'Phone'],
'order' => ['phone' => 'Phone'],
'items' => ['id' => 'uuid', 'amount' => 1],
]);
$deliveryOrders = $iiko->OrdersApi()->getDeliveryOrders($organization['id'], [
'dateFrom' => '2020-04-09',
'dateTo' => '2020-04-09',
]);
$protocols = $iiko->SettingsApi()->getSupportedProtocols($organization['id']);
$discounts = $iiko->DeliverySettingsApi()->getDeliveryDiscounts($organization['id']);