PHP
Clone or download
ovanschie Merge pull request #72 from orkhanahmadov/master
Ability to add custom headers through config. Added config publish command to readme file
Latest commit ef41a0f Jul 19, 2018
Permalink
Failed to load latest commit information.
config Added headers key Jul 7, 2018
src Added headers method Jul 7, 2018
tests fix test Jul 25, 2017
.editorconfig Init Feb 6, 2017
.gitattributes Init Feb 6, 2017
.gitignore Init Feb 6, 2017
.styleci.yml Init Feb 6, 2017
LICENSE.md Init Feb 6, 2017
README.md Added config publish command Jul 7, 2018
composer.json Update composer.json Jan 22, 2018
header.png header.png Mar 14, 2017
phpunit.xml.dist Init Feb 6, 2017

README.md

Laravel OPcache

Latest Version on Packagist Software License Total Downloads

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.

Requirements

This package requires Laravel 5.5 or newer. For older Laravel versions (5.1 or newer), you can use version 1.3.0

Installation

You can install the package via Composer:

composer require appstract/laravel-opcache

You can publish the config file with:

php artisan vendor:publish --provider="Appstract\Opcache\OpcacheServiceProvider" --tag="config"

For Lumen:

// bootstrap/app.php
$app->register(Appstract\Opcache\OpcacheServiceProvider::class);
$app->configure('opcache');

// config/app.php
'url' => env('APP_URL'),

// config/opcache.php
'directories' => [
    base_path('app'),
    base_path('bootstrap'),
    base_path('public'),
    base_path('routes'),
    base_path('vendor/appstract'),
    base_path('vendor/composer'),
    base_path('vendor/laravel/lumen-framework'),
    base_path('vendor/illuminate'),
]

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.

Usage

Login to your server/vm and run one of the commands.

Requests are only excepted from the same IP as the server IP.

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();

Contributing

Contributions are welcome, thanks to y'all :)

About Appstract

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.

License

The MIT License (MIT). Please see License File for more information.