Weave Code
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
Luigis Box Bundle

Luigis Box Bundle Laravel Package

answear/luigis-box-bundle

View on GitHub
Deep Wiki
Context7

Luigi's Box integration for Symfony.

Frequently asked questions about Luigis Box Bundle
What is the primary use case for the answear/luigis-box-bundle in Laravel applications?
This bundle integrates Luigi's Box—a content delivery and search service—into Laravel apps, enabling real-time content updates, search functionality, and caching. It’s ideal for e-commerce, marketing sites, or any Laravel project needing dynamic content delivery without heavy backend processing.
How do I install and configure the bundle for Laravel?
Run `composer require answear/luigis-box-bundle` to install. Configure it in `config/packages/answear_luigis_box.yaml` with your Luigi’s Box `publicKey` and `privateKey`. Set timeouts (e.g., `connectionTimeout`, `searchTimeout`) and cache TTL (max 300 seconds). No Laravel-specific setup is needed beyond Symfony compatibility.
Does this bundle work with Laravel 10, or is it limited to older versions?
The bundle is designed for Symfony, but it integrates seamlessly with Laravel via Composer. Check the Symfony version requirements in the README (likely Symfony 5.4+). Laravel 10 should work if your Symfony dependencies align, but test thoroughly for edge cases like middleware or service container conflicts.
Can I use multiple Luigi’s Box configurations (e.g., dev/staging/prod) in one Laravel app?
Yes. Define multiple configs in `answear_luigis_box.yaml` (e.g., `dev_config`, `prod_config`) and switch dynamically using `$configProvider->setConfig('config_name')`. This is useful for environment-specific endpoints or A/B testing setups.
How do I handle errors or timeouts when calling Luigi’s Box from Laravel?
The bundle throws exceptions for timeouts or failed requests (e.g., `ConnectionException`). Wrap calls in try-catch blocks or use Laravel’s `try-catch` in controllers. Log errors via Laravel’s logging system or monitor with tools like Sentry. Customize timeouts in the config to balance performance and reliability.
Is there a way to add custom headers to Luigi’s Box search requests from Laravel?
Yes. Use `$configProvider->setHeader('header-name', 'header-value')` before making requests. Reset all headers with `$configProvider->resetHeaders()`. This is useful for adding auth tokens, user agents, or custom metadata to track requests across services.
Will this bundle slow down my Laravel API if I enable caching (searchCacheTtl)?
Caching reduces Luigi’s Box API calls but adds minimal overhead. The `searchCacheTtl` (max 300s) controls how long cached responses persist. Test under load to ensure cache invalidation aligns with your content update frequency. For high-traffic APIs, monitor cache hit/miss ratios in Laravel’s logs.
Are there alternatives to this bundle for Laravel if Luigi’s Box isn’t the right fit?
For content delivery, consider Laravel-specific packages like `spatie/laravel-newsletter` (for newsletters) or `spatie/laravel-medialibrary` (for media). For search, use `spatie/laravel-searchable` or Elasticsearch via `scientifichackers/laravel-elasticsearch`. If you need Luigi’s Box’s specific features, this bundle is the most direct integration.
How do I test Luigi’s Box functionality in Laravel’s PHPUnit tests?
Mock the `RequestInterface` or use Laravel’s HTTP tests to simulate Luigi’s Box responses. Verify configs are loaded correctly by injecting `ConfigProvider` into tests. Test edge cases like timeouts or invalid keys by stubbing the bundle’s HTTP client (e.g., Guzzle). Example: `Http::fake([...])` for controlled responses.
Can I use this bundle in a Laravel queue job or scheduled task for batch content updates?
Yes, but batch operations may hit Luigi’s Box rate limits. Use `ContentUpdateCollection` to group updates and set appropriate timeouts in the config. For large batches, split into smaller chunks or process asynchronously. Monitor queue failures and retry logic in Laravel’s queue workers.
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.
comsave/common
alecsammon/php-raml-parser
chrome-php/wrench
lendable/composer-license-checker
typhoon/reflection
mesilov/moneyphp-percentage
mike42/gfx-php
bookdown/themes
aura/view
aura/html
aura/cli
povils/phpmnd
nayjest/manipulator
omnipay/tests
psr-mock/http-message-implementation
psr-mock/http-factory-implementation
psr-mock/http-client-implementation
voku/email-check
voku/urlify
rtheunissen/guzzle-log-middleware