- How do I install answear/luigis-box-bundle with Composer?
- Run composer require answear/luigis-box-bundle and let Composer resolve the version constraint against your PHP and Symfony requirements. After installation, provide the required publicKey and privateKey values in config/packages/answear_luigis_box.yaml under the answear_luigis_box key. The host defaults to https://live.luigisbox.com, so a minimal configuration is just the two keys.
- Can I use this Luigi's Box bundle in a Laravel application?
- The package is published as a Symfony bundle, so its YAML configuration, dependency injection wiring and bundle registration are Symfony-specific. The underlying ConfigProvider and service classes are plain PHP, so you can install the package with Composer and instantiate them manually inside a Laravel service provider. Expect to write your own bindings and configuration mapping rather than relying on auto-discovery. Check the composer.json constraints for supported PHP and Symfony versions before committing.
- How do I configure multiple Luigi's Box connections in one application?
- Define each connection under the configs node in answear_luigis_box.yaml, giving every entry its own publicKey, privateKey and optional host or timeout overrides. Set default_config to the name of the connection that should be active initially, or omit it entirely when only one config exists. All compiled configs are passed to Answear\LuigisBoxBundle\Service\ConfigProvider, which acts as the single entry point for the active connection.
- How do I switch Luigi's Box configuration at runtime?
- Inject ConfigProvider and call setConfig('your_config_name') before making a request; all subsequent search and content calls use that connection. For connections that cannot be expressed in YAML, use addConfig('name', new ConfigDTO(...)) to register a config dynamically. Because the provider is stateful, avoid mutating it in shared long-running workers unless you reset it between requests.
- How do I add custom headers to Luigi's Box search requests?
- Call setHeader('header-name', 'header-value') on the ConfigProvider to append a header to outgoing search requests, and call resetHeaders() to clear everything that was added. Headers are applied to the current provider state, so set them after you have selected the config you want to use. This is useful for passing correlation or tenant identifiers that Luigi's Box should record alongside the query.
- What timeouts does the bundle expose for Luigi's Box requests?
- Each config accepts connectionTimeout (default 4.0 seconds), requestTimeout (default 10.0 seconds) and searchTimeout (default 6.0 seconds). Search calls use the dedicated search timeout, so query latency can be tuned independently from content update calls. Set these values in the YAML config or through a dynamically registered ConfigDTO.
- What does searchCacheTtl do, and what is the maximum value?
- searchCacheTtl sets the time to live, in seconds, for cached Luigi's Box search requests and defaults to 0, which disables caching. Luigi's Box caps this at 300 seconds, so values above that limit are not supported. Use a short TTL for frequently changing catalogs and a higher one for stable result sets where latency matters most.
- How do I send content updates to Luigi's Box with this bundle?
- Build a ContentUpdate value object with the title, URL, object type and a nested array of additional fields, then wrap one or more of them in a ContentUpdateCollection. Pass the collection to the content request service to push a full content update document to Luigi's Box. Keeping object types consistent across updates makes later filtering and faceting predictable.
- Does the bundle support POST body filters instead of query string filters?
- Yes. Version 5.5.0 adds POST body filter support for search endpoints (PR #61, ANS-24319), allowing structured, nested filter payloads that are awkward or too long for a query string. The release notes do not state that GET query-string filtering was removed, so confirm the behaviour of your installed version before migrating external consumers. Because POST search bypasses typical GET caching and may hit different rate-limit or WAF rules, validate filter payloads and plan a cache strategy before enabling it broadly.
- What should I watch out for when running Luigi's Box search in production?
- POST-based search is not cacheable by default in browsers, CDNs or HTTP caches, so add an application-level cache keyed on a hash of the filter body if you depend on search performance. The guid field is the practical tracing handle for these calls, since the filter payload no longer appears in the URL. Enforce strict schema validation and nesting limits on incoming filters to avoid expensive queries becoming a denial-of-service vector. Roll the change out behind a flag or to internal consumers first, and confirm whether malformed filters return standardized errors or raw exceptions.