steve-moretz/laravel-opcache

This package allows you to clear OPcache from CLI.

1.0.3 2022-02-16 19:15 UTC

This package is auto-updated.

Last update: 2024-05-17 00:13:00 UTC


README

This Laravel package allows you to clear OPcache, solving a common problem related to cache invalidation during atomic deployments (also called "zero downtime deploy").

Getting Started

These instructions allow you to install the package into an existing Laravel app.

Installation

You can install this package via Composer using:

composer require steve-moretz/laravel-opcache

Config Website Url

php artisan vendor:publish --provider="SteveMoretz\LaravelOpcacheClear\OpcacheClearServiceProvider"

Now you can go ahead and change the website url if necessary.

Usage

Clear

php artisan opcache:clear

Watch Invalidate Cache

  1. First you need to install
yarn add chokidar
  1. Now can goto config/opcache.php and set watch_globs to list of directories and files you want to watch.

eg :

    "watch_globs" => [__DIR__ . "/../../**/*.php"]
  1. Now you can run
php artisan opcache:watch

Suggestion

Run this command during deployment process in order to automate the cleaning process before you app became active!