recombee/php-api-client
PHP client for the Recombee recommendation API, installable via Composer. Send recommendation, search, and event requests; batch large data; create users/items on the fly; and fetch follow-up recommendations with recommendation IDs. Supports regional endpoints and typed request/exception classes.
The package is a thin, synchronous PHP SDK over Recombee's REST recommendation API. It is not a recommendation engine itself — it is an egress client. That distinction drives every architectural decision a TPM needs to make.
AddPurchase, SetItemValues, AddDetailView, etc. The bulk of engineering effort will be instrumenting the Laravel app to emit these events reliably — observers, model events, job dispatch — not wiring up the client.Reqs\Batch, RecommendItemsToUser, RecommendNextItems) rather than a resourceful client, so it composes well with Laravel queues for batch ingestion and with a service-layer wrapper for reads.High. This is one of the lower-friction third-party integrations we could take on.
composer require recombee/php-api-client and a singleton binding in a service provider gets us to a working call in under an hour.config/services.php + .env covers it cleanly with 12-factor compliance.Batch request is the key affordance for scale — catalog syncs and backfilled interaction history should never be one-request-per-row.ApiTimeoutException, ResponseException, and a common ApiException parent give us enough to build a real fallback path (popular items, category bestsellers, empty state) rather than a generic catch.The one genuine feasibility gap: the README's examples are script-style with const declarations and echo, not framework-shaped. We will write our own wrapper — service class, DTOs, config, tests — regardless of what the SDK provides. Budget for that, not for the SDK.
| Risk | Severity | Mitigation |
|---|---|---|
| Vendor lock-in | High | Abstract behind a RecommendationService interface; treat Recombee IDs as external keys, never as primary keys |
| Latency on user-facing requests | High | Cache recommendations in Redis with short TTL; precompute for high-traffic surfaces; never call synchronously in a page render without a timeout |
| Low public adoption (26 stars, 0 dependents) | Medium | Offset by the fact this is a vendor-published official client — supported by Recombee, versioned in lockstep with their API, not an abandoned hobby project. Risk is vendor continuity, not maintainer burnout |
| Billing model exposure | Medium | Recombee charges on interaction volume and database size; unthrottled event logging can produce a surprise invoice. Instrument event counts as a first-class metric |
| PII in event payloads | Medium | User IDs only, no emails/names. Review GDPR/DPA posture before any production data flows |
| Silent data-model drift | Medium | Item/user property schemas live in Recombee's admin; we need a versioned schema definition checked into our repo |
| Sparse documentation beyond README | Low | Official API docs at docs.recombee.com are the real spec; the SDK is a thin mapper over it |
RecommendNextItems pagination semantics (the recommId cursor) for infinite-scroll surfaces?Strong for Laravel 9–11 on PHP 8.x. The SDK is dependency-light (Guzzle-based), which means it will not fight the framework's HTTP layer or a shared Guzzle instance.
Client as a singleton in a dedicated RecombeeServiceProvider, constructed from config('services.recombee.*').RecommendationService interface with a Recombee implementation and a cached/fallback implementation. Controllers and Blade/Livewire components depend on the interface, never the SDK.The README examples should be treated as API documentation, not as integration patterns. They do not demonstrate DI, queuing, or error strategy.
Greenfield is trivial. The realistic scenarios are replacements:
Do not attempt a big-bang cutover of all personalization surfaces at once. Recommendation quality is judged subjectively by stakeholders and needs incremental evidence.
us-west, ap-se, etc.) matters for latency — pick the region nearest the application servers, not the user base, since the call originates server-side.^6.2 and review changelogs on minor bumps. Vendor SDKs occasionally change request signatures alongside API deprecations.RecommendationService interface, fallback implementation, observability (log every call's latency and outcome).Batch, backfill 90 days of interaction history from existing order/view tables.SearchItems if search is in scope.Low code-churn, moderate configuration-churn. The SDK itself will need almost no attention — vendor releases track API versions. The ongoing work is elsewhere:
This is an official vendor client, so support routes to Recombee's commercial support channel — which is a function of the contract, not the GitHub repo. That is the correct mental model: we are buying a service, and the SDK is a convenience wrapper around it. Escalation paths, SLAs, and uptime commitments should be negotiated at the contract level, not inferred from the package.
Internally, at least two engineers should understand the write-path instrumentation. Single-owner knowledge of the event pipeline is the most likely operational failure point.
Two independent scaling concerns:
Batch request exists precisely for this.Database size in Recombee grows with catalog and user count, which affects billing more than performance. Monitor both.
| Failure | User Impact | Response |
|---|---|---|
| API timeout | Missing rec block | Serve cached; then fallback to popular-by-category; never block render |
| Auth/token error | Total rec outage | Alert immediately; it is a config error, not transient |
| Rate limit | Throttled writes → stale model | Backoff with jitter; buffer events in a local table for replay |
| Malformed event (unknown user/item) | Rejected write, no user impact | cascadeCreate where safe; log and audit rejects weekly |
| Queue backlog | Model trains on stale data | Alert on queue depth; separate worker pool |
| Vendor outage | All personalization dark | Documented fallback UI; measure revenue impact during incidents |
The critical design rule: no personalization surface may be on the critical path of a page render without a hard timeout and a fallback. The README states this plainly, and it is the one piece of guidance worth enforcing as a merge-blocking standard.
TPM verdict: approve as a buy decision with a mandatory abstraction layer and a feature-flagged, one-surface-at-a-time rollout. The package is low-risk technically and thin enough that it will never become load-bearing in the wrong way — but the commitment being made is to Recombee as a service, and that commitment should be scoped, priced, and owned before the first line of integration code is written.
How can I help you explore Laravel packages today?