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
Laravel Opcache

Laravel Opcache Laravel Package

elcobvg/laravel-opcache

A Laravel package for monitoring and managing PHP OPcache. It provides a status dashboard and Artisan commands to clear, reset, and optimize OPcache, helping keep cached PHP scripts fresh after deployments.

View on GitHub
Deep Wiki
Context7

Custom OPcache Cache Driver for Laravel. Faster than Redis, Memcache or APC.

Frequently asked questions about Laravel Opcache
What is elcobvg/laravel-opcache used for?
It is a Laravel package that adds an OPcache-backed cache driver and tools for monitoring and managing PHP OPcache. It fits node-local, read-heavy caching of regenerable values such as computed page fragments or expensive read-only query results. It is not a shared Redis replacement for sessions, queues, locks, rate limiting, or cross-node coordination.
How do I install elcobvg/laravel-opcache in a Laravel app?
Install it with Composer using elcobvg/laravel-opcache. Laravel may auto-discover the service provider; if not, register the provider manually. Then add an OPcache cache store in config/cache.php and confirm OPcache is enabled for PHP-FPM with a writable cache path.
Which Laravel and PHP versions does laravel-opcache support?
The provided package context does not list exact Laravel or PHP version constraints. Check the package composer.json, README, releases, and issue tracker before adopting it. Because adoption is low, test compatibility against your target Laravel and PHP versions rather than assuming support.
Is laravel-opcache really faster than Redis or Memcache?
The package description claims it is faster than Redis, Memcache, or APC, but performance depends heavily on workload and deployment shape. OPcache caching is node-local, while Redis and Memcache provide shared network caching and broader features. Benchmark realistic read/write ratios before treating the speed claim as a production decision.
Can I use laravel-opcache as my primary Laravel cache store?
The technical assessment recommends not replacing your primary cache store with this driver. Add it as an additional Laravel cache store and migrate only low-risk, read-heavy cache keys after benchmarking. Keep Redis, database, or file cache for sessions, queues, locks, and any cross-node coordination.
Does elcobvg/laravel-opcache support TTL, tags, increment/decrement, and atomic locks?
These Laravel cache contract details are flagged as needing verification in the assessment. The driver may only partially implement features such as tags, atomic operations, TTL semantics, locks, and serialization. Test every cache feature you depend on before using it for production-critical data.
How do I clear or reset OPcache after deployment with laravel-opcache?
The package provides Artisan commands to clear, reset, and optimize OPcache, along with a status dashboard. However, CLI and PHP-FPM can have separate OPcache instances, so an Artisan command may not clear the same cache state your web workers use. Test deployment sequencing and OPcache reset behavior in your actual hosting setup.
Is laravel-opcache safe for multi-node or container deployments?
It is a node-local OPcache cache driver, so multiple app servers or containers can return inconsistent cached values. It is a poor fit for autoscaled ephemeral containers, serverless environments, or workloads needing Redis-style shared state. Use it only on a single VM or independently cached nodes where eventual consistency is acceptable.
What OPcache settings should I check before using laravel-opcache?
Confirm OPcache is enabled for PHP-FPM, not just CLI, and review opcache.memory_consumption, opcache.max_accelerated_files, opcache.validate_timestamps, opcache.revalidate_freq, and opcache.restrict_api. Verify file permissions and cache directory placement. OPcache exhaustion, restriction, or restart can drop entries and cause load spikes, so test those failure modes.
How should I test and monitor laravel-opcache in production?
Use the package's status dashboard and Artisan management commands to inspect and manage OPcache state. Benchmark it against Redis, file cache, and APCu under realistic read/write ratios, and monitor OPcache memory, hit rate, restarts, and stale-data behavior. Keep a configuration rollback path to another Laravel cache store in case results differ from expectations.
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.
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource