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
Ai Cache Platform

Ai Cache Platform Laravel Package

symfony/ai-cache-platform

Symfony AI Cache Platform bridge that integrates Cache Platform as a caching backend for Symfony AI. Enables storing and retrieving AI-related cache entries via Cache Platform, improving performance and reuse across requests.

View on GitHub
Deep Wiki
Context7

Cache platform bridge for Symfony AI

Frequently asked questions about Ai Cache Platform
How do I install Symfony AI Cache Platform in a Laravel project using symfony/ai?
Add the package via Composer with `composer require symfony/ai-cache-platform`, then register the Symfony CachePlatform as a Laravel service provider in `config/app.php`. Ensure your Laravel cache drivers (e.g., Redis) are properly configured in `config/cache.php` for compatibility. The package bridges Symfony’s CachePlatform to Laravel’s PSR-6 cache layer automatically.
Which Laravel cache drivers are officially supported by this package?
The package leverages Laravel’s native PSR-6 cache drivers, so Redis, Memcached, and file-based caching are supported. For production, Redis is recommended due to its low latency and scalability. Ensure your `config/cache.php` is configured to use a supported driver before integrating the bridge.
Can I use this package for caching non-AI-related data in Laravel?
No, this package is specifically designed for caching AI-generated responses within the Symfony AI ecosystem. It’s not a general-purpose caching solution for Laravel. For broader caching needs, consider Laravel’s built-in cache drivers or packages like `spatie/laravel-cache`.
What Laravel versions are compatible with symfony/ai-cache-platform?
The package aligns with Symfony AI’s compatibility, which currently supports Laravel 10.x and 11.x. Check the package’s `composer.json` for exact version constraints, as Symfony AI may introduce breaking changes. Always test with your Laravel version before deploying to production.
How do I configure TTL (time-to-live) for cached AI responses?
TTL is configured via Symfony’s CachePlatform settings, typically in your Symfony AI configuration. For Laravel integration, override the default TTL by binding a custom cache pool in your service provider. Example: Use `CachePoolInterface` with a 30-minute TTL for volatile AI responses like recommendations.
Does this package support cache invalidation for AI model updates?
The package relies on manual or tag-based invalidation. For AI model updates, listen to Laravel’s `CacheCleared` event or implement a custom invalidation strategy using tags (e.g., `ai:model:v1`). Avoid long TTLs for frequently updated models to minimize stale data risks.
What are the performance implications of using this cache bridge?
Caching reduces redundant AI computations but adds latency for cache misses. Benchmark with and without caching to validate cost savings. Use short TTLs (e.g., 5–30 minutes) for volatile data like dynamic content. Monitor cache hit/miss ratios via Laravel’s debug tools or Prometheus.
How do I handle multi-tenancy with this package to avoid data leakage?
Use tenant-aware cache keys (e.g., `tenant:{id}:{key}`) or separate cache pools per tenant. Configure Symfony’s CachePlatform to namespace keys or leverage Laravel’s cache tags with tenant-specific prefixes. Avoid shared caches for sensitive AI responses.
Are there alternatives to this package for caching AI responses in Laravel?
For Laravel-specific solutions, consider `spatie/laravel-cache` or custom PSR-6 implementations like `stashphp/stash`. However, these lack Symfony AI integration. If you’re using Symfony AI, this bridge is the most direct path, but evaluate alternatives if you need broader caching flexibility or event-driven invalidation.
How do I test this package in a Laravel CI pipeline?
Mock Symfony AI’s cache dependencies using Laravel’s `Cache::shouldReceive()` or PHPUnit’s `CacheInterface` mocks. Test edge cases like cache misses, TTL expirations, and invalidation events. Ensure your CI environment matches production cache drivers (e.g., Redis) to catch integration issues early.
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.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky