PHP code example of codeofsolomon / laravel-iiko-cloud-api

1. Go to this page and download the library: Download codeofsolomon/laravel-iiko-cloud-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/ */

    

codeofsolomon / laravel-iiko-cloud-api example snippets


return [
    /*
    |--------------------------------------------------------------------------
    | Authentication
    |--------------------------------------------------------------------------
    |
    | iikoCloud login.
    |
    */
    'login' => env('IIKO_CLOUD_LOGIN'),

    /*
    |--------------------------------------------------------------------------
    | HTTP
    |--------------------------------------------------------------------------
    */
    'base_uri' => env('IIKO_BASE_URI', 'https://api-ru.iiko.services/api/1/'),
    'timeout' => env('IIKO_CLOUD_TIMEOUT', 15.0),

    /*
    |--------------------------------------------------------------------------
    | Token cache
    |--------------------------------------------------------------------------
    |
    | The TTL is automatically calculated from the expiresIn value in the response,
    | but you can set a hard upper limit here.
    |
    */
    'token_cache_ttl' => env('IIKO_TOKEN_TTL', 60 * 59), // 59 min
    'cache_store' => env('IIKO_CACHE_STORE', null),        // null → driver по-умолчанию
];

use Codeofsolomon\Iiko\Facades\IikoApi;

// Retrieve a list of regions
$response = IikoApi::getRegions([
    'organization' => config('iiko-api.organization_id'),
]);

$regions = $response->toArray();

use Codeofsolomon\Iiko\Api\IikoApiClient;

class OrderController extends Controller
{
    public function index(IikoApiClient $client)
    {
        $terminals = $client->getTerminalGroups([
            'organization' => config('iiko-api.organization_id'),
        ]);

        return response()->json($terminals);
    }
}
bash
php artisan vendor:publish --tag=iiko-api-config