luqra / now-php
Requires
- php: >=8.2
- brick/date-time: >=0.7.0
- brick/math: >=0.12.1
- galbar/jsonpath: >=3.0
- guzzlehttp/guzzle: ^7.0
- phpdocumentor/type-resolver: >=1.8
- speakeasy/serializer: ^4.0.3
Requires (Dev)
- laravel/pint: 1.29.0
- phpstan/phpstan: 2.1.44
- phpunit/phpunit: ^11.5.50 || ^12.5.8 || >=13.0.0
- roave/security-advisories: dev-latest
This package is auto-updated.
Last update: 2026-04-29 17:09:34 UTC
README
Developer-friendly, idiomatic PHP SDK for the luqra/now-php API.
Summary
Luqra Now API: External API for Luqra Now
Table of Contents
SDK Installation
The SDK relies on Composer to manage its dependencies.
To install the SDK run the following command:
composer require luqra/now-php
SDK Example Usage
Example
declare(strict_types=1); require 'vendor/autoload.php'; use Luqra\LuqraNowPhp; $sdk = LuqraNowPhp\LuqraNow::builder() ->setSecurity( '<YOUR_BEARER_TOKEN_HERE>' ) ->build(); $response = $sdk->contacts->list( originatorId: '1d7999d2-66f8-428f-af77-7a969541638f' ); if ($response->object !== null) { // handle response }
Authentication
Per-Client Security Schemes
This SDK supports the following security scheme globally:
| Name | Type | Scheme |
|---|---|---|
bearerAuth |
http | HTTP Bearer |
To authenticate with the API the bearerAuth parameter must be set when initializing the SDK. For example:
declare(strict_types=1); require 'vendor/autoload.php'; use Luqra\LuqraNowPhp; $sdk = LuqraNowPhp\LuqraNow::builder() ->setSecurity( '<YOUR_BEARER_TOKEN_HERE>' ) ->build(); $response = $sdk->contacts->list( originatorId: '1d7999d2-66f8-428f-af77-7a969541638f' ); if ($response->object !== null) { // handle response }
Available Resources and Operations
Error Handling
Handling errors in this SDK should largely match your expectations. All operations return a response object or throw an exception.
By default an API error will raise a Errors\APIException exception, which has the following properties:
| Property | Type | Description |
|---|---|---|
$message |
string | The error message |
$statusCode |
int | The HTTP status code |
$rawResponse |
?\Psr\Http\Message\ResponseInterface | The raw HTTP response |
$body |
string | The response content |
When custom error responses are specified for an operation, the SDK may also throw their associated exception. You can refer to respective Errors tables in SDK docs for more details on possible exception types for each operation. For example, the list method throws the following exceptions:
| Error Type | Status Code | Content Type |
|---|---|---|
| Errors\ErrorResponse | 400, 401 | application/json |
| Errors\ErrorResponse | 500 | application/json |
| Errors\APIException | 4XX, 5XX | */* |
Example
declare(strict_types=1); require 'vendor/autoload.php'; use Luqra\LuqraNowPhp; use Luqra\LuqraNowPhp\Models\Errors; $sdk = LuqraNowPhp\LuqraNow::builder() ->setSecurity( '<YOUR_BEARER_TOKEN_HERE>' ) ->build(); try { $response = $sdk->contacts->list( originatorId: '1d7999d2-66f8-428f-af77-7a969541638f' ); if ($response->object !== null) { // handle response } } catch (Errors\ErrorResponseThrowable $e) { // handle $e->$container data throw $e; } catch (Errors\ErrorResponseThrowable $e) { // handle $e->$container data throw $e; } catch (Errors\APIException $e) { // handle default exception throw $e; }
Server Selection
Select Server by Index
You can override the default server globally using the setServerIndex(int $serverIdx) builder method when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers:
| # | Server | Description |
|---|---|---|
| 0 | https://staging.api.now.luqra.com |
Sandbox |
| 1 | https://api.now.luqra.com |
Production |
Example
declare(strict_types=1); require 'vendor/autoload.php'; use Luqra\LuqraNowPhp; $sdk = LuqraNowPhp\LuqraNow::builder() ->setServerIndex(0) ->setSecurity( '<YOUR_BEARER_TOKEN_HERE>' ) ->build(); $response = $sdk->contacts->list( originatorId: '1d7999d2-66f8-428f-af77-7a969541638f' ); if ($response->object !== null) { // handle response }
Override Server URL Per-Client
The default server can also be overridden globally using the setServerUrl(string $serverUrl) builder method when initializing the SDK client instance. For example:
declare(strict_types=1); require 'vendor/autoload.php'; use Luqra\LuqraNowPhp; $sdk = LuqraNowPhp\LuqraNow::builder() ->setServerURL('https://api.now.luqra.com') ->setSecurity( '<YOUR_BEARER_TOKEN_HERE>' ) ->build(); $response = $sdk->contacts->list( originatorId: '1d7999d2-66f8-428f-af77-7a969541638f' ); if ($response->object !== null) { // handle response }
For information on releasing a new version of this SDK, see RELEASING.md.