andriymiz / iiko-biz-api
A wrapper for iiko biz API
Installs: 114
Dependents: 0
Suggesters: 0
Security: 0
Stars: 12
Watchers: 4
Forks: 10
Open Issues: 0
Requires
- php: >=7.2.0
- guzzlehttp/guzzle: ^6.5
- illuminate/support: ~5.8.0|^6.0|^7.0|^8.0
README
A simple Object Oriented wrapper for iiko API, written with PHP.
Uses iiko API v0.
Features
- Light and fast thanks to lazy loading of API classes
Requirements
- PHP >= 7.2
Install
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
Basic usage of iiko-biz-api
client
<?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']);