luqra/now-php

PHP SDK for the Luqra Now API

Maintainers

Package info

github.com/luqrahq/luqra-now-php-sdk

pkg:composer/luqra/now-php

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.1.1 2026-03-05 01:26 UTC

This package is auto-updated.

Last update: 2026-03-06 01:21:00 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 and add it as a dependency to an existing composer.json file:

composer require "luqra/now-php"

SDK Example Usage

Example

declare(strict_types=1);

require 'vendor/autoload.php';

use Luqra\Now;
use Luqra\Now\Models\Operations;

$sdk = Now\LuqraNow::builder()
    ->setSecurity(
        '<YOUR_BEARER_TOKEN_HERE>'
    )
    ->build();

$requestBody = new Operations\PatchV0ContactsIdRequestBody();

$response = $sdk->patchV0ContactsId(
    id: '<id>',
    requestBody: $requestBody

);

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\Now;
use Luqra\Now\Models\Operations;

$sdk = Now\LuqraNow::builder()
    ->setSecurity(
        '<YOUR_BEARER_TOKEN_HERE>'
    )
    ->build();

$requestBody = new Operations\PatchV0ContactsIdRequestBody();

$response = $sdk->patchV0ContactsId(
    id: '<id>',
    requestBody: $requestBody

);

if ($response->object !== null) {
    // handle response
}

Available Resources and Operations

Available methods

contacts

LuqraNow SDK

payments

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 patchV0ContactsId method throws the following exceptions:

Error Type Status Code Content Type
Errors\ErrorResponse 400, 401, 403, 404, 409 application/json
Errors\ErrorResponse 500 application/json
Errors\APIException 4XX, 5XX */*

Example

declare(strict_types=1);

require 'vendor/autoload.php';

use Luqra\Now;
use Luqra\Now\Models\Errors;
use Luqra\Now\Models\Operations;

$sdk = Now\LuqraNow::builder()
    ->setSecurity(
        '<YOUR_BEARER_TOKEN_HERE>'
    )
    ->build();

try {
    $requestBody = new Operations\PatchV0ContactsIdRequestBody();

    $response = $sdk->patchV0ContactsId(
        id: '<id>',
        requestBody: $requestBody

    );

    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 Test
1 https://api.now.luqra.com Production

Example

declare(strict_types=1);

require 'vendor/autoload.php';

use Luqra\Now;
use Luqra\Now\Models\Operations;

$sdk = Now\LuqraNow::builder()
    ->setServerIndex(1)
    ->setSecurity(
        '<YOUR_BEARER_TOKEN_HERE>'
    )
    ->build();

$requestBody = new Operations\PatchV0ContactsIdRequestBody();

$response = $sdk->patchV0ContactsId(
    id: '<id>',
    requestBody: $requestBody

);

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\Now;
use Luqra\Now\Models\Operations;

$sdk = Now\LuqraNow::builder()
    ->setServerURL('https://api.now.luqra.com')
    ->setSecurity(
        '<YOUR_BEARER_TOKEN_HERE>'
    )
    ->build();

$requestBody = new Operations\PatchV0ContactsIdRequestBody();

$response = $sdk->patchV0ContactsId(
    id: '<id>',
    requestBody: $requestBody

);

if ($response->object !== null) {
    // handle response
}

Contributions

While we value open-source contributions to this SDK, this library is generated programmatically. Any manual changes added to internal files will be overwritten on the next generation. We look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release.