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
Simple Cache Bridge

Simple Cache Bridge Laravel Package

cache/simple-cache-bridge

Exposes an existing PSR-6 cache pool through the PSR-16 CacheInterface, letting you reuse one pool for both standards. Install with composer require cache/simple-cache-bridge:^2.0. Supports psr/cache 3 and psr/simple-cache 2 and 3.

View on GitHub
Deep Wiki
Context7

PSR-6 to PSR-16 bridge lets you reuse an existing PSR-6 cache pool wherever a PSR-16 CacheInterface is expected. Wrap any pool in SimpleCacheBridge and it transparently adapts the richer PSR-6 API to the simplified PSR-16 contract—no duplicate cache configuration or extra adapter code required.

  • Adapts any PSR-6 pool to PSR-16 in one line
  • Version 2 supports psr/cache 3 and psr/simple-cache 2 & 3
  • Ships with the php-cache ecosystem (e.g. ArrayCachePool)
  • Install via Composer: cache/simple-cache-bridge:^2.0
Frequently asked questions about Simple Cache Bridge
How do I install cache/simple-cache-bridge in a Laravel app?
Run composer require cache/simple-cache-bridge:^2.0. The package has no Laravel service provider or auto-discovery, so you construct SimpleCacheBridge yourself with an existing PSR-6 pool. Then bind the resulting PSR-16 CacheInterface in a service provider or resolve it where needed.
Can I use cache/simple-cache-bridge as a Laravel CACHE_DRIVER?
No, that is not a supported path. Laravel's cache manager expects a driver callback to return an Illuminate cache Store, not a PSR-16 CacheInterface, so registering this bridge via Cache::extend() or CACHE_DRIVER will fail at resolution time. Use a container binding for the PSR-16 CacheInterface and constructor injection instead.
How do I bind SimpleCacheBridge in Laravel's service container?
Register a singleton for the PSR-16 CacheInterface that builds SimpleCacheBridge with your PSR-6 pool. For example, resolve your pool from the container and pass it to new SimpleCacheBridge($pool). Inject the PSR-16 interface into the services that need it rather than trying to make it a cache driver.
Does cache/simple-cache-bridge work with Laravel's built-in cache stores?
It is redundant for Laravel's own stores because Laravel already provides Psr16Cache and Psr6Cache adapters for them. The bridge is useful when you have an external PSR-6 pool that Laravel cannot natively expose as PSR-16. If your consumer can use Laravel's cache repository contract, skip the bridge.
Does SimpleCacheBridge support cache tags or per-item expiration?
No, PSR-16 has no tags and no per-item expiresAfter() equivalent, so anything downstream of the bridge gets the lowest common denominator. Tag-based invalidation does not survive the crossing. TTLs are passed through PSR-16 set calls, but null, zero, and negative TTL semantics can differ from PSR-6 and may silently change item lifetimes.
How does SimpleCacheBridge translate PSR-6 exceptions to PSR-16 exceptions?
The README does not document exception translation, so treat it as unverified. PSR-6 pools may throw Psr\Cache\InvalidArgumentException or CacheException, while PSR-16 consumers expect the Psr\SimpleCache equivalents. Test this with a fake pool that throws, and wrap calls at your boundary if PSR-6 exceptions leak.
Are setMultiple and getMultiple efficient through SimpleCacheBridge?
Expect batch methods to be implemented as loops over single-key PSR-6 calls. Against Redis or Memcached that multiplies network round-trips, so large setMultiple or getMultiple payloads can be much slower than a native PSR-16 client. Benchmark your real workload and avoid the bridge for hot batch paths.
Which PSR and PHP versions does cache/simple-cache-bridge support?
Version 2 implements psr/cache 3 and supports psr/simple-cache 2 and 3. The documentation reflects testing against older PHP runtimes, so PHP 8.1+ behavior and future PSR-16 conformance are not guaranteed by the project. Verify compatibility in your own CI matrix before rollout.
When should I use cache/simple-cache-bridge instead of Symfony's Psr16Cache?
Use it only when you must keep a specific PSR-6 pool and a consumer requires PSR-16. Laravel's Psr16Cache adapts Laravel stores, not arbitrary third-party PSR-6 pools, so it does not cover that case. Symfony's Psr16Cache also bridges PSR-6 to PSR-16 and has stronger maintenance, so evaluate it first for external pools.
Is cache/simple-cache-bridge maintained and safe for production?
It is a small MIT-licensed single-class package with roughly 42 stars, zero dependents, and single-organisation stewardship, so supply-side risk is higher than engineering risk. The split repository is read-only and issues route to the main php-cache tracker. Pin the version, add conformance tests, and consider wrapping it in your own thin adapter for production.
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.
hsluv/hsluv
seampact/codegen
seampact/hooks
seampact/ir
mehedimi/laravel-amp-mail
happones/laravel-vue-i18n-generator
jwerd/inertia-table
siberfx/flysystem-wasabi
hollyit/token-replace
ippanelcom/laravel-sdk
adachsoft/changelog-linter
adachsoft/collection
payerurl/telegrambot-crypto-payment-instant-payout
dskripchenko/laravel-hybrid-search
riorizkyrainey/lara-ced
mehedimi/static-vel
zharp/zharp
nonsapiens/bigquery-model-sync
lgu-bayambang-ict-office/lgu-laravel-development-standards
andydefer/laravel-support