Download the PHP package noosh24/open-api without Composer
On this page you can find all versions of the php package noosh24/open-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download noosh24/open-api
More information about noosh24/open-api
Files in noosh24/open-api
Package open-api
Short Description Official PHP client for the Noosh24 Open API
License MIT
Homepage https://developer.noosh24.com
Informations about the package open-api
Menu, reservations, orders and bills, payments and the Z-report, tables, customers, loyalty, stock and reviews of a Noosh24 venue, plus creating and cancelling reservations.
[!IMPORTANT] Keep the API key on your server. A key belongs to one venue and opens its data: guests' phone numbers, payments, and writing reservations. Never put it in a browser, a mobile app or a public repository.
Contents: License
Requirements
- PHP 8.2 or newer (tested on 8.2, 8.3, 8.4 and 8.5),
ext-curl,ext-json. No other dependencies.
Install
Quick start
The key belongs to one venue, so there is no venue parameter anywhere. Keys are issued in the Noosh24 panel; keep them on your server, never in a browser or a mobile app.
Options
timeout is in seconds. transport takes your own Noosh24\OpenApi\Http\Transport if you do not want cURL.
Resources
| Group | Methods |
|---|---|
whoami() |
the venue, the key's scopes and the venue's modules |
menu |
listCategories(), listProducts(), iterateProducts(), getProduct($id, $expand), getStopList() |
reservations |
list(), iterate(), get($id), availability($date, $time, $guests), create([...]), cancel($id) |
orders |
list(), iterate(), get($id), listBills(), iterateBills(), getBill($id) |
payments |
list(), iterate(), get($id), zReport($date) |
tables |
list(), listHalls() |
customers |
list(), iterate(), get($id) |
loyalty |
getProgram(), listCards(), iterateCards() |
stock |
listIngredients(), iterateIngredients(), listMoves(), iterateMoves(), listStores() |
reviews |
list(), iterate() |
Every response is a typed model (Product, Reservation, Order, ...) with public properties named as in the API. Timestamps are DateTimeImmutable in UTC, money is float in AZN. $model->toArray() gives the raw JSON, including fields this version of the SDK does not know yet.
Lists, filters and pages
List methods take limit, offset, sort, where and, for products, expand. They return a Page with items, total, limit, offset and hasMore().
where is AND only. Build it with Where so strings and dates are quoted correctly:
The iterate*() methods walk every page for you and fetch the next page only when you reach it:
offset stops at 10000. For bigger exports, narrow where by date and walk one window at a time.
Reservations
A booking lands as pending and the venue confirms it. Always send externalRef (your own booking id): sending the same externalRef again returns the booking that already exists instead of making a second one, so a create is safe to retry. The client retries a create only when it carries an externalRef. You can cancel only bookings your key created.
Errors
Every API error throws a subclass of Noosh24\OpenApi\Exception\ApiException with getStatus(), getErrorCode() (the API's error field), getMessage() and getHeaders(). Branch on the class or on getErrorCode(), not on the message.
error |
Exception | Parent |
|---|---|---|
validation_error |
ValidationException |
ApiException |
no_api_key |
NoApiKeyException |
AuthenticationException |
invalid_api_key |
InvalidApiKeyException |
AuthenticationException |
insufficient_scope |
InsufficientScopeException |
PermissionDeniedException |
module_not_enabled |
ModuleNotEnabledException |
PermissionDeniedException |
venue_suspended |
VenueSuspendedException |
PermissionDeniedException |
not_your_reservation |
NotYourReservationException |
PermissionDeniedException |
not_found |
NotFoundException |
ApiException |
table_not_found |
TableNotFoundException |
NotFoundException |
table_taken |
TableTakenException |
ConflictException |
cannot_cancel |
CannotCancelException |
ConflictException |
outside_hours, in_the_past, table_too_small |
OutsideHoursException, InThePastException, TableTooSmallException |
UnprocessableException |
rate_limit_exceeded |
RateLimitException (getRetryAfter()) |
ApiException |
temporarily_unavailable |
TemporarilyUnavailableException |
ServerException |
A network failure or timeout throws ConnectionException. All of them implement Noosh24Exception.
Retries and rate limits
A key gets 600 requests a minute. On 429 and 502/503/504 the client waits (Retry-After when the API sends it, otherwise 0.5 s, 1 s, 2 s ...) and tries again, up to maxRetries times. It never waits more than 60 seconds; a longer Retry-After is thrown to you as a RateLimitException. Reads, cancels and creates with an externalRef are retried; a create without an externalRef is not.
Development
License
MIT
All versions of open-api with dependencies
ext-curl Version *
ext-json Version *