sixdays/opcache-bundle
Symfony bundle for inspecting and managing PHP OPcache from your app: view cache statistics, memory usage, hit rates, and cached scripts, then reset or invalidate OPcache when needed. Useful for debugging performance and deployments.
opcache.validate_timestamps=0 for performance — a common and defensible choice — then a deploy without an invalidation step means the old code keeps serving traffic. That is the "fix is deployed but not live" incident class. The package is a reminder to make this an explicit, auditable pipeline step rather than an implicit hope.services.xml, Symfony Console command registration. No service provider, no facade, no extra.laravel block. For a Laravel target, the bundle wiring is dead weight; only the small command class is even portable. If the shortlist was generated by keyword matching, fix the catalogue — this will otherwise keep resurfacing in Laravel evaluations.optimize:clear, Symfony's cache commands, or an FPM reload) usually win this axis because they are already maintained and already in the deploy recipe.Consider it only when all of the following hold:
validate_timestamps=0 or a long revalidate frequency, so bytecode genuinely survives a file change.opcache.enable_cli=0 and none at all), so a CLI-invoked reset frequently clears nothing that matters and exits 0 — a green deploy step with false assurance. Where that mismatch exists, use a tool that talks to the FPM socket (cachetool) or a plain FPM/worker reload.Look elsewhere when:
optimize:clear / clear-compiled path already covers compiled-file and OPcache invalidation; adding this is pure duplication.opcache.restrict_api or disable_functions is set in hardened images — the reset can be suppressed without a surfaced error.octane:reload leaves stale code running.In every "look elsewhere" case, capture the underlying requirement ("deploy must invalidate OPcache deterministically, and we must be able to prove it did") as a pipeline task with a verification step.
Bottom line: do not adopt as a dependency; solve the underlying need directly. Adopt the pattern, not the package.
For executives. This is a 30-star, archived, single-command utility with no licensing cost and no strategic value. Adopting it would add an unmaintained entry to the supply chain in exchange for roughly twenty lines of code we would own anyway. There is no commercial or roadmap impact either way. The only question that matters — does our deploy reliably invalidate stale bytecode? — is a one-line addition to the pipeline plus a verification check. Recommend: reject the dependency, fund the pipeline step, close the item.
For engineering. The package addresses a real problem — stale OPcache after deploy when timestamp validation is disabled — but the problem is better solved one level down. On Laravel, the framework already handles it. On Symfony, either a deploy hook calling opcache_reset() in the correct context, or a cachetool invocation against the FPM socket, covers it. Three ranked options: (A) vendor the ~30-line command as a native command with no external dependency — acceptable; (B) replace with cachetool, maintained and FastCGI-based — recommended if cache invalidation is genuinely required; (C) install the bundle and bridge Symfony wiring into Laravel — reject, no benefit over A and inherits archived-repo risk and stale constraints.
The trap to communicate explicitly. A reset executed from a separate CLI process usually does not touch the web workers' shared memory. A green deploy step therefore does not guarantee fresh bytecode. Validate the premise on staging first: run the reset, mutate a known file, confirm the served app picks up the change. If it does not, re-scope to the FPM-socket approach.
Operational notes worth carrying regardless of decision.
opcache_reset() returns false on failure; throw rather than log-and-continue, and verify with a smoke assertion (e.g. a version-constant endpoint) so the step fails loudly instead of no-op'ing.Recommendation. Reject as a composer require; treat archived status as disqualifying for a dependency and merely inconvenient for a copy-paste. Vendored code becomes ours to own — defensible at roughly an hour of ownership per year, but record it as a deliberate fork. The real deliverable is organisational: make the team aware that a CLI OPcache reset does not touch FPM, add the reset to the deploy pipeline as an explicit step, and add the post-deploy verification ("prove the reset reached the serving process") to the runbook so we are not encoding a false sense of safety.
How can I help you explore Laravel packages today?