Laravel OPcache Package
Published on by Eric L. Barnes
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:
php artisan opcache:clear
Show OPcache config:
php artisan opcache:config
Show OPcache status:
php artisan opcache:status
Pre-compile your application code (experimental, test before you deploy):
php 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.
Eric is the creator of Laravel News and has been covering Laravel since 2012.