An unofficial Laravel SDK for the IIKO Cloud API, providing a convenient way to integrate your Laravel application with the iikoCloud restaurant management platform.
- PHP ^8.2
- Laravel ^10.0 || ^11.0 || ^12.0
- ext-json
- GuzzleHTTP ^7.9
- nyholm/psr7 ^1.8
- psr/http-client ^1.0
- psr/http-message ^2.0
- webmozart/assert ^1.11
Install the package via Composer:
composer require codeofsolomon/laravel-iiko-cloud-apiAfter installing, publish the configuration file:
php artisan vendor:publish --tag=iiko-api-configThis will copy the configuration file to config/iiko-api.php.
Open the published config file (config/iiko-api.php) and set your credentials and preferences:
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 по-умолчанию
];Add the following to your .env file:
IIKO_BASE_URI=https://api-ru.iiko.services/api/1/
IIKO_CLOUD_LOGIN=your-client-login
IIKO_CACHE_STORE=null
IIKO_CLOUD_TIMEOUT=3500The package registers a service binding and a facade (IikoApi). You can inject the client or use the facade in your application.
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);
}
}Refer to the source code in src/Api for a full list of available methods and their parameters.
Access tokens are automatically fetched and cached according to the settings in the configuration file. You generally do not need to manage tokens manually.
Contributions are welcome! Please:
- Fork the repository
- Create a new branch for your feature or bugfix
- Write tests and ensure existing tests pass
- Submit a Pull Request with a clear description of your changes
This package is open-sourced software licensed under the MIT license.