curnext / sdk
Official CurNext PHP SDK for the construction readiness API
Requires
- php: ^8.1
- ext-curl: *
- ext-json: *
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Official PHP client for the CurNext construction readiness API.
Use it from Laravel, Symfony, or plain PHP to pull surface readiness, BIM context, devices, alerts, measurements, and webhook configuration into your own dashboards, ERP, CMMS, or automation pipelines - with API-key auth over HTTPS.
| Package | curnext/sdk |
| Version | 1.0.0 |
| Runtime | PHP 8.1+ (ext-curl, ext-json) |
| API base | https://api.curnext.app (/api/v1) |
| OpenAPI | https://api.curnext.app/docs |
| Platform | https://curnext.app |
Table of contents
- Install
- Quick start
- Authentication
- Configuration
- API surface
- Error handling
- Webhooks
- Local development & smoke test
- Laravel & Symfony
- Author & support
- License
Install
composer require curnext/sdk
use Curnext\Sdk\CurNext; use Curnext\Sdk\CurNextApiException;
Quick start
<?php use Curnext\Sdk\CurNext; $client = new CurNext( apiKey: getenv('CURNEXT_API_KEY') ?: '', // baseUrl defaults to https://api.curnext.app ); $health = $client->health->get(); // ['status' => 'ok', 'service' => 'curnext-api', 'version' => '…', 'api' => '/api/v1'] $projects = $client->projects->list(); $readiness = $client->projects->getReadiness('SURFACE_EXTERNAL_ID'); echo $readiness['status'], ' ', $readiness['readiness_score'] ?? '', PHP_EOL;
Authentication
- Open the CurNext platform → your project → API keys.
- Create a project key (
cn_live_…). - Pass it to the client. The SDK sends:
Authorization: Bearer cn_live_…
API access is included with Professional (and Enterprise programs). Keys and webhook endpoints are managed in the product UI - this SDK is a consumer of the public REST API.
Never commit live keys. Prefer environment variables:
export CURNEXT_API_KEY=cn_live_…
Configuration
$client = new CurNext( apiKey: 'cn_live_…', // required baseUrl: 'https://api.curnext.app', // optional (default) );
| Option | Default | Notes |
|---|---|---|
apiKey |
- | Required. Project API key. |
baseUrl |
https://api.curnext.app |
Host only - do not append /api/v1 (the SDK adds it). |
Local API:
$client = new CurNext( apiKey: getenv('CURNEXT_API_KEY') ?: '', baseUrl: 'http://localhost:4000', );
API surface
All methods return decoded associative arrays. Failures throw CurNextApiException.
Health
$client->health->get(); // ['status', 'service' => 'curnext-api', 'version', 'api' => '/api/v1']
Projects
| Method | Description |
|---|---|
projects->list() |
Projects visible to the API key |
projects->get($projectId) |
Project summary |
projects->listMembers($projectId) |
Members & invitations |
projects->listAuditEvents($projectId, $page?, $limit?, $eventType?) |
GDPR / compliance audit trail |
projects->getSubscription($projectId) |
Subscription + recent invoices |
projects->getReadiness($surfaceId) |
Latest surface readiness prediction |
Surfaces & predictions
$client->surfaces->getReadiness($surfaceId); // alias of projects->getReadiness $client->predictions->list($surfaceId, $limit);
BIM
$client->bim->get($projectId); // buildings → floors → rooms → surfaces tree
Devices
$client->devices->list($projectId); $client->devices->get($deviceId);
Alerts
$client->alerts->list($projectId, $resolved, $limit); $client->alerts->get($alertId); $client->alerts->resolve($alertId);
Measurements
$client->measurements->listCycles($buildingId, $limit); $client->measurements->latestDevice($deviceId);
Webhooks (read)
$client->webhooks->list($projectId);
Create / edit / delete webhook receivers in the CurNext dashboard. The API lists active endpoints (events include readiness, alerts, devices including DEVICE_DISPLACED, compliance, and handover).
Low-level
$client->request('/custom/path', 'GET', ['foo' => 'bar'], $body);
Paths without /api/ are prefixed with /api/v1/.
Error handling
use Curnext\Sdk\CurNext; use Curnext\Sdk\CurNextApiException; try { $readiness = $client->projects->getReadiness('SURFACE_ID'); echo $readiness['status']; } catch (CurNextApiException $e) { // 401 invalid key · 403 forbidden · 404 not found · 429 rate limited · 5xx server error_log($e->getStatusCode() . ' ' . $e->getMessage()); var_export($e->getBody()); throw $e; }
| Method / property | Type | Description |
|---|---|---|
getStatusCode() / $statusCode |
int |
HTTP status |
getMessage() |
string |
Human-readable error |
getErrorCode() / $codeName |
?string |
Optional API error code |
getBody() / $body |
mixed |
Raw response payload |
Webhooks
Outbound event delivery is configured in the product (HTTPS URL, scope, event types, signing secret).
- List configs:
$client->webhooks->list() - Event catalog includes
SURFACE_READY,ALERT_CREATED,DEVICE_DISPLACED,PROJECT_HANDOVER_READY, and more - Verify signatures with the secret shown once at creation (
X-CurNext-Signature)
Full event list and REST reference: OpenAPI UI.
Local development & smoke test
Maintainers working in the CurNext monorepo (packages/sdk-php):
# terminal 1 - API pnpm --filter api dev # terminal 2 - PHP SDK smoke (health, projects, webhooks) cd packages/sdk-php composer install CURNEXT_API_KEY=cn_live_… \ CURNEXT_API_BASE=http://localhost:4000 \ composer smoke
Laravel & Symfony
No framework binding is required. Resolve a singleton / service with your project API key:
Laravel (AppServiceProvider):
$this->app->singleton(CurNext::class, function () { return new CurNext( apiKey: (string) config('services.curnext.key'), baseUrl: config('services.curnext.base_url'), ); });
Symfony (services.yaml):
Curnext\Sdk\CurNext: arguments: $apiKey: '%env(CURNEXT_API_KEY)%' $baseUrl: '%env(default::CURNEXT_API_BASE)%'
Author & support
| Author | Awunjia Serge Atabong |
| Company | CurNext Oy (CurNext) |
| Copyright | © 2026 CurNext Oy |
| Website | https://curnext.app |
| Contact | info@curnext.app |
| API docs | https://api.curnext.app/docs |
| Product | Manage keys & webhooks in the CurNext dashboard |
| Sales / API access | https://curnext.app/contact |
| Issues | github.com/awunjia/CurNext/issues |
| Source (monorepo) | packages/sdk-php |
| Publish repo | github.com/awunjia/curnext-sdk-php (Packagist VCS) |
CurNext provides construction readiness intelligence - surface curing status, site alerts, BIM context, and device fleet APIs - so decisions leave the dashboard and enter your stack.
License
MIT © 2026 CurNext Oy · Awunjia Serge Atabong