steve-moretz / laravel-opcache
This package allows you to clear OPcache from CLI.
1.0.3
2022-02-16 19:15 UTC
Requires
- php: >=5.5.9
- guzzlehttp/guzzle: >=5.3.0
- laravel/framework: >=7.0
- steve-moretz/file-system-watcher: >=1.0.2
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
- First you need to install
yarn add chokidar
- 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"]
- 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!