Laravel OPcache Package


April 5th, 2017

Laravel OPcache Package

PHP, since version 5.5, comes bundled with OPcache which improves performance. Here is how PHP documentation explains it:

OPcache improves PHP performance by storing precompiled script bytecode in shared memory, thereby removing the need for PHP to load and parse scripts on each request.

One of the drawbacks to implementing OPcache is that you have to clear the cache every time you change any PHP code. Because of this, the team at Appstract has created a Laravel Artisan package that gives you quick and easy commands for OPcache. Here are a few usage examples:

Clear OPcache:

1php artisan opcache:clear

Show OPcache config:

1php artisan opcache:config

Show OPcache status:

1php artisan opcache:status

Pre-compile your application code (experimental, test before you deploy):

1php artisan opcache:optimize

To learn more about this package check out the GitHub Repository which includes all the instructions and everything you’ll need to get started.

Filed in:

Eric L. Barnes

Eric is the creator of Laravel News and has been covering Laravel since 2012.