PHP code example of andriymiz / iiko-biz-api

1. Go to this page and download the library: Download andriymiz/iiko-biz-api library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

andriymiz / iiko-biz-api example snippets




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']);

bash
$ php artisan vendor:publish --provider="Iiko\Biz\IikoBizServiceProvider"