Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Boxalino Client Sdk Php Laravel Package

boxalino/boxalino-client-sdk-php

PHP client SDK for integrating Boxalino's search, navigation, and personalization services into ecommerce sites. It provides API wrappers for querying product catalogs and retrieving personalized search results, with Composer-based installation for Laravel or standalone PHP projects.

View on GitHub
Deep Wiki
Context7

Getting Started

This is the first release containing the CPO Narratives integration, so start by confirming the package name and install command in its README, then require it with Composer and publish its config:

composer require <vendor>/<package>
php artisan vendor:publish --provider="<Vendor>\CpoNarratives\CpoNarrativesServiceProvider"

Look first at:

  1. The published config file — Boxalino account/domain, API endpoint, API key or client credentials, cache TTL, and any narrative slot definitions.
  2. The service provider — what is bound into the container, whether a facade is registered, and which Blade components/directives are available.
  3. The package README examples — the fastest path to a working call.

A typical first use case is rendering a personalized narrative block on the home page or product page. The flow is usually: resolve a visitor/customer context, request one or more narratives for that context, then render the returned content in Blade. The exact API will be package-specific, but expect something shaped like:

use Vendor\CpoNarratives\Facades\Narratives;

$narrative = Narratives::context([
    'customer_id' => auth()->id(),
    'page_type'   => 'home',
    'locale'      => app()->getLocale(),
])->get('homepage_hero');
{!! $narrative?->render() !!}

Before wiring it into production views, verify credentials against the Boxalino sandbox or a staging account and confirm that the API returns a narrative for a known test context.

Implementation Patterns

Context resolution belongs in one place. Rather than passing customer/session/page data at every call site, build a small context resolver (a service, middleware, or request macro) that assembles the Boxalino context once per request. Controllers and Blade views should consume that context, not reconstruct it.

Wrap the client in your own gateway. Even a thin application-level wrapper around the package facade pays off: it gives you a single place for fallback behavior, logging, cache keys, and later API changes. This is especially important for a v1.5 feature whose API surface may still move.

Render narratives through a Blade component. Encapsulate retrieval and rendering in a component such as <x-boxalino-narrative slot="homepage_hero" />. That keeps views clean, makes fallback content explicit, and gives you one place to handle empty responses.

Cache per context, not globally. Narrative responses are personalized, so the cache key must include the relevant context dimensions (customer/visitor ID, locale, page type, slot). Use the package's cache settings if present, but verify the key strategy. If the package caches internally, confirm it does not collapse different visitors into one entry.

Fallback content is part of the pattern. Treat Boxalino as an enhancement, not a hard dependency. Every narrative slot should have a sensible default so a slow or failed API call does not break the page.

<x-boxalino-narrative slot="homepage_hero">
    <x-default-hero />
</x-boxalino-narrative>

Test with a fake or stub client. Bind a fake implementation of the package client in tests so you can assert that the correct context and slot are requested without hitting the network. If the package does not provide a fake, wrap it behind an interface you can swap.

Use it for multiple slots, not one-off calls. The value of CPO Narratives comes from personalizing several placements (hero, recommendations, category copy, product upsell). Define your slots centrally in config and iterate over them, rather than scattering ad hoc API calls through controllers.

Integration tip: resolve context early. If the context depends on authentication or a visitor cookie, resolve it in middleware and store it on the request. This avoids ordering problems when narratives are rendered in layout partials, view composers, or early Blade sections.

Gotchas and Tips

  • This is a first release for the feature. v1.5 introduces CPO Narratives for the first time. Pin the version in composer.json, read the changelog before upgrading, and expect the API or config keys to evolve in subsequent releases.
  • Do not cache personalized output globally. The most common failure mode is a response cached without the visitor/customer dimension, leaking one user's narrative to another. Audit both Laravel's cache and any package-level caching.
  • Watch API latency on page render. A synchronous narrative call in a Blade view adds latency to every request. Use the package's cache where possible, keep timeouts short, and always render fallback content.
  • Handle missing credentials gracefully. Local and CI environments often lack Boxalino credentials. Ensure the package fails soft (returns null/empty) rather than throwing during page render. Add a config flag or environment check if it does not.
  • Run php artisan config:cache after config changes. As with any Laravel package, config values read at boot time will be stale until the cache is rebuilt. This catches people when rotating API keys.
  • Check consent and data-minimization requirements. You are sending customer identifiers and page context to a third party. Confirm what identifiers the package sends, whether they are hashed or pseudonymized, and whether consent gating is required in your jurisdiction.
  • Inspect the raw response when debugging. If narratives render empty, log the raw API response and the context sent. Most issues are a missing context field, a slot name mismatch, or an account/domain configuration error rather than a code bug.
  • Look for extension points before forking. Common extension points in packages like this are a bindable client interface, events around requests/responses, and configurable renderers. Use them for custom logging, retries, or fallback logic instead of editing vendor code.
  • Keep an eye on the package's HTTP client. If it depends on Guzzle or Laravel's HTTP client, confirm timeout and retry settings are configurable. Default timeouts are often too long for a synchronous page render.
  • Version your slot names. Narrative slot identifiers are effectively an external contract with the Boxalino configuration. Treat renames as breaking changes and keep them in config rather than hard-coded in views.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
socialdept/atp-orm
cboxdk/laravel-assistant-client
socialdept/atp-resolver
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings
coleus/apps
seampact/laravel
emmyconceptng/laravel-ng-postcode
jjsquady/round-robin