Installation
Initialize the client
The SDK uses a Bearer token for authentication. Obtain an access token by exchanging your SDK credentials and pass it when creating the client:Configuration options
| Option | Type | Default | Description |
|---|---|---|---|
baseUrl | string | required | API base URL |
accessToken | string | required | Bearer token from the auth token endpoint |
timeoutMs | int | 10000 | HTTP request timeout in ms |
maxRetries | int | 2 | Retry count on 429/5xx/timeouts |
collateWindowSeconds | float | 3 | Buffer events for this many seconds before flushing |
maxBatchSize | int | 200 | Flush immediately when the buffer reaches this size |
maxBufferedEvents | int | 5000 | Drop oldest events beyond this limit |
maxEventRetries | int | 5 | Retry count for buffered event sends |
disableArrayBatching | bool | false | Force single-event sends |
propagateRecommendationRequestId | bool | true | Auto-attach request_id from recommendations to subsequent events |
sessionId | string or null | null | Override the SDK-wide session ID |
autoSessionId | bool | true | Auto-generate a session UUID |
httpClient | callable | cURL | Custom HTTP transport for non-cURL environments or tests |
Get recommendations
id, object, item_id, rank, score, and an embedded item object with the metadata you stored. The response also includes a request_id for event attribution.
Search
Usesearch when the user supplies a free-text query and you want ranked catalog items back through the Core API data plane:
https://api.neuronsearchlab.com/v1/search, not the console Platform API. Search responses use the same item shape as recommendations and include query, request_id, data, and recommendations.
Auto-generated sections
UsegetAutoRecommendations for paginated, auto-titled recommendation sections:
Track events
Events provide the feedback loop that powers personalization. The PHP SDK buffers events in memory for the lifetime of the current process.How batching works in PHP
Force delivery when needed
You can force delivery with
flushEvents() or by calling ->wait() on the returned PendingResult.Request ID propagation
WhenpropagateRecommendationRequestId is enabled, the SDK captures the request_id from getRecommendations() or search() and automatically attaches it to subsequent trackEvent() calls unless you explicitly provide requestId or request_id.
Manage catalog items
Create an item
Update an item
Delete items
Error handling
The SDK exposesSDKHttpError and SDKTimeoutError:
Logging
Configure structured logging for debugging and observability:TRACE, DEBUG, INFO, WARN, ERROR, FATAL.
Session management
The SDK auto-generates a session UUID on initialization whenautoSessionId is enabled. You can override or read it:

