PHP code example of noosh24 / open-api
1. Go to this page and download the library: Download noosh24/open-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/ */
noosh24 / open-api example snippets
oosh24\OpenApi\Client;
use Noosh24\OpenApi\Where;
$noosh = new Client(getenv('NOOSH24_API_KEY'));
$me = $noosh->whoami();
echo $me->restaurant->name, PHP_EOL;
print_r($me->key->scopes);
$page = $noosh->menu->listProducts([
'where' => Where::create()->eq('category', 'Salads')->eq('available', true),
'sort' => 'price desc',
'limit' => 50,
]);
foreach ($page as $product) {
printf("%s %.2f AZN\n", $product->name, $product->price);
}
echo $page->total, ' products match', PHP_EOL;
$noosh = new Client('nsk_...', [
'baseUrl' => 'https://open-api.noosh24.com/v1',
'timeout' => 30,
'maxRetries' => 2,
'userAgent' => 'acme-pos/2.1',
]);
$page = $noosh->orders->list([
'where' => "status = 'served' AND createdAt >= '2026-11-01'",
'sort' => ['createdAt desc'],
'limit' => 100,
'offset' => 0,
]);
$where = Where::create()
->eq('status', 'confirmed')
->gte('startsAt', new DateTimeImmutable('2026-11-20T00:00:00+04:00'))
->in('zone', ['Terrace', "Chef's table"]);
foreach ($noosh->payments->iterate(['where' => "createdAt >= '2026-11-01'"]) as $payment) {
// ...
}
use Noosh24\OpenApi\Exception\TableTakenException;
$free = $noosh->reservations->availability('2026-11-20', '19:30', 4);
try {
$result = $noosh->reservations->create([
'date' => '2026-11-20',
'time' => '19:30',
'guests' => 4,
'guestName' => 'Aysel Məmmədova',
'phone' => '+994501234567',
'tableId' => $free->tables[0]->id,
'externalRef' => 'acme-booking-991',
]);
} catch (TableTakenException $e) {
// someone took the table first
}
echo $result->reservation->code, $result->created ? ' created' : ' already existed', PHP_EOL;
$noosh->reservations->cancel($result->reservation->id);