2017 © Pedro Peláez
 

library laravel-varnishable

Simple and easy varnish integration in Laravel

image

richan-fongdasen/laravel-varnishable

Simple and easy varnish integration in Laravel

  • Thursday, July 26, 2018
  • by richan-fongdasen
  • Repository
  • 1 Watchers
  • 0 Stars
  • 464 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

Build codecov Scrutinizer Code Quality StyleCI Analysis Status Total Downloads Latest Stable Version License: MIT, (*1)

Laravel Varnishable

Simple and easy varnish integration in Laravel, (*2)

Synopsis

This package offers easy ways to integrate your Laravel application with Varnish Cache., (*3)

Table of contents

Setup

Install the package via Composer :, (*4)

$ composer require richan-fongdasen/laravel-varnishable

Laravel version compatibility

Laravel version Varnishable version
5.1.x - 5.4.x 0.x
5.5.x - 5.8.x 1.0.x - 1.1.x
6.x 1.2.x
7.x 1.3.x
8.x ^1.4.x
9.x 2.0.x
10.x 2.1.x
11.x 2.2.x

If you are using Laravel version 5.5+ then you can skip registering the service provider in your Laravel application., (*5)

Service Provider

Add the package service provider in your config/app.php, (*6)

'providers' => [
    // ...
    RichanFongdasen\Varnishable\ServiceProvider::class,
];

Alias

Add the package's alias in your config/app.php, (*7)

'aliases' => [
    // ...
    'Varnishable' => RichanFongdasen\Varnishable\Facade::class,
];

Publish package assets

Publish the package asset files using this php artisan command, (*8)

$ php artisan vendor:publish --provider="RichanFongdasen\Varnishable\ServiceProvider"

The command above would create new varnishable.php file in your application's config directory., (*9)

Configuration

return [

    /*
    |--------------------------------------------------------------------------
    | Varnish hosts
    |--------------------------------------------------------------------------
    |
    | Specify the hostnames of your varnish instances. You can use array
    | to specify multiple varnish instances.
    |
    */
    'varnish_hosts' => env('VARNISH_HOST', '127.0.0.1'),

    /*
    |--------------------------------------------------------------------------
    | Varnish port
    |--------------------------------------------------------------------------
    |
    | Specify the port number that your varnish instances are listening to.
    |
    */
    'varnish_port' => env('VARNISH_PORT', 6081),

    /*
    |--------------------------------------------------------------------------
    | Cache duration
    |--------------------------------------------------------------------------
    |
    | Specify the default varnish cache duration in minutes.
    |
    */
    'cache_duration' => env('VARNISH_DURATION', 60 * 24),

    /*
    |--------------------------------------------------------------------------
    | Cacheable header
    |--------------------------------------------------------------------------
    |
    | Specify the custom HTTP header that we should add, so Varnish can
    | recognize any responses containing the header and cache them.
    |
    */
    'cacheable_header' => 'X-Varnish-Cacheable',

    /*
    |--------------------------------------------------------------------------
    | Uncacheable header
    |--------------------------------------------------------------------------
    |
    | Specify the custom HTTP header that we should add, so Varnish won't
    | cache any reponses containing this header.
    |
    */
    'uncacheable_header' => 'X-Varnish-Uncacheable',

    /*
    |--------------------------------------------------------------------------
    | Use ETag Header
    |--------------------------------------------------------------------------
    |
    | Please specify if you want to use ETag header for any of your static
    | contents.
    |
    */
    'use_etag' => true,

    /*
    |--------------------------------------------------------------------------
    | Use Last-Modified Header
    |--------------------------------------------------------------------------
    |
    | Please specify if you want to use Last-Modified header for any of your
    | static contents.
    |
    */
    'use_last_modified' => true,

    /*
    |--------------------------------------------------------------------------
    | ESI capability header
    |--------------------------------------------------------------------------
    |
    | Please specify the ESI capability header that the varnish server would
    | send if there is any ESI support.
    |
    */
    'esi_capability_header' => 'Surrogate-Capability',

    /*
    |--------------------------------------------------------------------------
    | ESI reply header
    |--------------------------------------------------------------------------
    |
    | Please specify the HTTP header that you want to send as a reply
    | in response to ESI capability header which the varnish server sent in
    | current request.
    |
    */
    'esi_reply_header' => 'Surrogate-Control',

];

Usage

This section is currently under construction., (*10)

Credits

License

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

The Versions

26/07 2018
26/07 2018

dev-modify-cache-duration-at-runtime

dev-modify-cache-duration-at-runtime https://github.com/richan-fongdasen/laravel-varnishable

Simple and easy varnish integration in Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Richan Fongdasen

laravel varnish laravel-5-package varnish-cache

26/06 2018

0.2.1

0.2.1.0 https://github.com/richan-fongdasen/laravel-varnishable

Simple and easy varnish integration in Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Richan Fongdasen

laravel varnish laravel-5-package varnish-cache

25/06 2018

0.2.0

0.2.0.0 https://github.com/richan-fongdasen/laravel-varnishable

Simple and easy varnish integration in Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Richan Fongdasen

laravel varnish laravel-5-package varnish-cache

20/06 2018

0.1.0

0.1.0.0 https://github.com/richan-fongdasen/laravel-varnishable

Simple and easy varnish integration in Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Richan Fongdasen

laravel varnish laravel-5-package varnish-cache