This package contains some useful Artisan commands to work with PHP OPcache.
If you want to learn more about OPcache and what it can do for your Laravel app, you can read the article on Medium.
You can install the package via Composer:
composer require appstract/laravel-opcache
Then register the service provider to your config/app.php
file:
'providers' => [
...
Appstract\Opcache\OpcacheServiceProvider::class,
];
For Lumen:
// bootstrap/app.php
$app->register(Appstract\Opcache\OpcacheServiceProvider::class);
// config/app.php
'url' => env('APP_URL'),
Make sure your APP_URL is set correctly in .env. If you want to set a different url to call the OPcache routes (for use with a load balancer for example), you can set OPCACHE_URL.
Login to your server/vm and run one of the commands.
Clear OPcache:
php artisan opcache:clear
Show OPcache config:
php artisan opcache:config
Show OPcache status:
php artisan opcache:status
Pre-compile your application code:
php artisan opcache:optimize
Programmatic usage:
use Appstract\Opcache\OpcacheFacade as OPcache;
...
OPcache::clear();
Contributions are welcome, thanks to y'all :)
Appstract is a small team from The Netherlands. We create (open source) tools for webdevelopment and write about related subjects on Medium. You can follow us on Twitter, buy us a beer or support us on Patreon.
The MIT License (MIT). Please see License File for more information.