ecollectors/cloud-sdk

Official PHP/Laravel SDK for the eCollectors Cloud API (M6.2) — generated models and Requests, hand-maintained facade.

Maintainers

Package info

github.com/manishamitl/cloud-sdk-php

Homepage

Issues

Documentation

pkg:composer/ecollectors/cloud-sdk

Transparency log

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

v1.0.0 2026-07-23 05:42 UTC

This package is auto-updated.

Last update: 2026-07-23 05:58:34 UTC


README

License: MIT

The official PHP client for the eCollectors Cloud API (M6.2, ecollectors/cloud-sdk). Generated models and endpoint definitions, wrapped by a small hand-maintained facade — the only class you ever import is EcollectorsCloud.

Full API reference, authentication guide, and error code reference: docs.ecollectors.cloud — this README stays short on purpose; the docs site is the canonical source, this SDK just wraps it.

Install

composer require ecollectors/cloud-sdk

Authentication

The platform has two independent auth modes, and this SDK has one constructor for each:

use Ecollectors\CloudSdk\EcollectorsCloud;

// An `ec_{env}_…` API key — the data plane (Search, Knowledge Delivery).
$client = EcollectorsCloud::withApiKey('ec_production_...');

// A Sanctum token from register()/login() — self-service account
// management (Organisations, Products, Applications, Environments, Keys).
$client = EcollectorsCloud::withUserToken($token);

Examples

Search (data plane, API key):

$results = $client->search()->query('kgv half rupee 1912');

Knowledge Delivery (data plane, API key):

$variant = $client->knowledge()->variant('KGV1R-1911-CAL');

Self-service account management (CloudUser token):

$auth = EcollectorsCloud::withApiKey('')->auth()->register([
    'name' => 'Ada Lovelace',
    'email' => 'ada@example.test',
    'password' => 'correct-horse-battery-staple',
]);

$client = EcollectorsCloud::withUserToken($auth->token);

$organisation = $client->organisations()->create(['name' => 'NumisPoint Ltd']);
$product = $client->products()->create($organisation->id, ['name' => 'NumisPoint']);
$application = $client->applications()->create($organisation->id, $product->id, ['name' => 'Website']);

Errors

Every failure throws a typed exception under Ecollectors\CloudSdk\Exceptions, one per API error code — NotFoundException, ValidationException, UnauthenticatedException, RateLimitedException, ConflictException, and so on — all extending EcollectorsCloudException, which carries the original status, problemCode, detail, and docsUrl.

use Ecollectors\CloudSdk\Exceptions\NotFoundException;

try {
    $client->knowledge()->variant('NO-SUCH-VARIANT');
} catch (NotFoundException $e) {
    // $e->status === 404, $e->problemCode === 'not_found'
}

Contract version

Every release is generated from a specific, pinned commit of the platform's OpenAPI contract:

EcollectorsCloud::contractVersion(); // '452ffd6ab234...'

Development

This package's src/Generated/ tree is generated, never hand-edited — see generator/ for the (deliberately narrow) generation logic and bin/sync-contract / bin/generate for the regeneration workflow.

composer install
composer generate   # regenerate src/Generated/ from contract/openapi.yaml
composer test

License

MIT — see LICENSE.