symfony/polyfill-apcu
Symfony Polyfill / APCu brings the apcu_* functions and the APCuIterator class to projects still running the legacy APC extension, letting older code use APCu without changes. Lightweight compatibility layer from Symfony, released under the MIT license.
apcu_* functions and APCuIterator by delegating to the legacy apc_* extension. It only has effect on a host running the deprecated APC extension, which does not exist on PHP 5.5+. Every Laravel version in service (5.1 through 12) requires PHP ≥ 5.5.9, so the addressable population in our install base is approximately zero. The decision this supports is a kill, not a backlog item.ext-apcu is a one-line CACHE_STORE change, not a dependency. Adopting this for portability yields no working cache and a false sense of coverage.composer.json.Decision summary
| Decision | Recommendation | Evidence required |
|---|---|---|
| Adopt for a new feature | No | — |
| Keep as transitive dependency | Verify inert; no action | composer why, php -m |
Remove from composer.json |
Yes, if directly required | grep -r "apcu_" returns nothing load-bearing |
| Replace with a config change | Yes, for missing-extension cases | config/cache.php, .env |
| Invest in native APCu tuning | Only if APCu is already installed and process-local caching is acceptable | Benchmark with Telescope/Blackfire |
Adopt only when all of the following hold:
apcu_* functions directly, and refactoring to the Cache facade is out of scope for the current horizon.It is also acceptable to leave it in place as an unexamined transitive dependency — don't spend cycles on it; confirm it is inert on the target PHP version and note it for the next composer audit.
Look elsewhere if:
ext-apcu simply is not installed on PHP 7.x/8.x. The polyfill supplies no store; ApcuStore will still be empty. Fix the driver, not the function table.apcu_inc, apcu_cas) under concurrency.Adoption checklist before any commit: grep -rn "apcu_" app/ config/ vendor/ to see whether usage is real; composer why symfony/polyfill-apcu to see who pulled it in; php -m | grep -i apc on the actual target host; confirm store selection in config/cache.php and config/session.php; write down what breaks when the cache is empty. Note also that extension_loaded('apcu') stays false after the polyfill loads — Laravel's CacheManager guards the apcu driver on that check, so CACHE_DRIVER=apcu will still throw. The polyfill satisfies function existence, not capability detection.
For executives / business leaders
"We evaluated
symfony/polyfill-apcufor [initiative]. Recommendation: do not adopt, and remove it if it is already in our dependency tree. It is a compatibility shim for PHP 5.4-era servers running the deprecated APC extension — a population we no longer support, since our minimum PHP is [X]. It does not make caching work where APCu is absent; the vendor's own README limits it to legacy-APC users, and Laravel's APCu driver still refuses to start because the extension check fails. Adopting it adds a dependency and a false sense of portability. The real fix — routing caching through Redis or file cache via one environment variable — is hours of work, not weeks. Ask: approve closing the APCu compatibility ticket as won't-do and reallocate that effort to [caching/performance initiative]."
For engineering leads
"
symfony/polyfill-apcuis a proxy, not an implementation: it mapsapcu_*onto the legacyapc_*functions. Consequences: no storage on PHP 7/8, no benefit on shared hosting, no performance win, and it becomes dead weight the moment Symfony raises its PHP floor — it is already issuing releases with 'no significant changes' and has zero listed dependents. Keep it out ofcomposer.jsondeliberately. If a teammate proposes it for 'APCu portability,' the correct change isconfig/cache.phpplusCACHE_STORE. If it is already transitive, verify it is inert and schedule removal in the next dependency sweep. Next steps: (1)composer why symfony/polyfill-apcu; (2)grep -rn "apcu_" app/ config/; (3)php -m | grep -i apcon the target host; (4) if the answer is 'no native APCu,' switch the affected store and delete the ticket."
For developers
"Don't add this to fix a missing
ext-apcu. It has no cache of its own — it just forwards toapc_*, and if neither extension is present those calls fatal rather than degrade gracefully.extension_loaded('apcu')remainsfalse, soCache::store('apcu')still throws and any package gating onapcu_enabled()bypasses the shim entirely. If you need a cache that always works:Cache::store('file')locally,Cache::store('redis')in production, and never letapcu_*be load-bearing for correctness. If you genuinely need APCu semantics on an already-APCu-enabled host, use the native extension and let Laravel'sApcuStoredo its job. Keep the polyfill out of hot paths and out of new code entirely."
Success criteria for this decision: no application code depends on apcu_* for correctness; every environment has a cache driver that works without ext-apcu; the package is either absent from composer.json or recorded as knowingly inert.
How can I help you explore Laravel packages today?