PHPackages                             richan-fongdasen/laravel-varnishable - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. richan-fongdasen/laravel-varnishable

ActiveLibrary[HTTP &amp; Networking](/categories/http)

richan-fongdasen/laravel-varnishable
====================================

Simple and easy varnish integration in Laravel

2.3.0(1y ago)830.5k↑263.6%[2 issues](https://github.com/richan-fongdasen/laravel-varnishable/issues)MITPHPPHP ^8.0CI passing

Since Jun 20Pushed 1y ago1 watchersCompare

[ Source](https://github.com/richan-fongdasen/laravel-varnishable)[ Packagist](https://packagist.org/packages/richan-fongdasen/laravel-varnishable)[ Docs](https://github.com/richan-fongdasen/laravel-varnishable)[ RSS](/packages/richan-fongdasen-laravel-varnishable/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (10)Dependencies (11)Versions (19)Used By (0)

[![Build](https://github.com/richan-fongdasen/laravel-varnishable/actions/workflows/main.yml/badge.svg?branch=main)](https://github.com/richan-fongdasen/laravel-varnishable/actions/workflows/main.yml)[![codecov](https://camo.githubusercontent.com/a06e4cca904d6bc00d5e214072cd426ca81617cbd15e2700b06fe94eb621e467/68747470733a2f2f636f6465636f762e696f2f67682f72696368616e2d666f6e67646173656e2f6c61726176656c2d7661726e69736861626c652f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/richan-fongdasen/laravel-varnishable)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/f19a8dbf36ee9145cd339892e67d15a59d3e4e3cb8fc4cb7722bb298256e0415/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f72696368616e2d666f6e67646173656e2f6c61726176656c2d7661726e69736861626c652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/richan-fongdasen/laravel-varnishable/?branch=master)[![StyleCI Analysis Status](https://camo.githubusercontent.com/77e625cf550a671bfbe0609c81b96d79035d50106a02dec796449db2d3edb4d9/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3133353738373339322f736869656c643f6272616e63683d6d6173746572)](https://github.styleci.io/repos/135787392)[![Total Downloads](https://camo.githubusercontent.com/1acad0ae3e00c1b942376ad047530c0883e9a5dbba33eb0a304e5271deecb100/68747470733a2f2f706f7365722e707567782e6f72672f72696368616e2d666f6e67646173656e2f6c61726176656c2d7661726e69736861626c652f642f746f74616c2e737667)](https://packagist.org/packages/richan-fongdasen/laravel-varnishable)[![Latest Stable Version](https://camo.githubusercontent.com/82d6ad6ac88375e4a53e00d1ee99c5cc9bd2c88d9d00c91f8261e7ffc514f5cc/68747470733a2f2f706f7365722e707567782e6f72672f72696368616e2d666f6e67646173656e2f6c61726176656c2d7661726e69736861626c652f762f737461626c652e737667)](https://packagist.org/packages/richan-fongdasen/laravel-varnishable)[![License: MIT](https://camo.githubusercontent.com/f45d904953153ca304a2328243d2733e095eee13a631a1f390709885d41dd692/68747470733a2f2f706f7365722e707567782e6f72672f6c61726176656c2f6672616d65776f726b2f6c6963656e73652e737667)](https://opensource.org/licenses/MIT)

Laravel Varnishable
===================

[](#laravel-varnishable)

> Simple and easy varnish integration in Laravel

Synopsis
--------

[](#synopsis)

This package offers easy ways to integrate your Laravel application with Varnish Cache.

Table of contents
-----------------

[](#table-of-contents)

- [Setup](#setup)
- [Publish package assets](#publish-package-assets)
- [Configuration](#configuration)
- [Usage](#usage)
- [Credits](#credits)
- [License](#license)

Setup
-----

[](#setup)

Install the package via Composer :

```
$ composer require richan-fongdasen/laravel-varnishable
```

### Laravel version compatibility

[](#laravel-version-compatibility)

Laravel versionVarnishable version5.1.x - 5.4.x0.x5.5.x - 5.8.x1.0.x - 1.1.x6.x1.2.x7.x1.3.x8.x^1.4.x9.x2.0.x10.x2.1.x11.x2.2.x> If you are using Laravel version 5.5+ then you can skip registering the service provider in your Laravel application.

### Service Provider

[](#service-provider)

Add the package service provider in your `config/app.php`

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

### Alias

[](#alias)

Add the package's alias in your `config/app.php`

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

Publish package assets
----------------------

[](#publish-package-assets)

Publish the package asset files using this `php artisan` command

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

The command above would create new `varnishable.php` file in your application's config directory.

Configuration
-------------

[](#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
-----

[](#usage)

This section is currently under construction.

Credits
-------

[](#credits)

- [spatie/laravel-varnish](https://github.com/spatie/laravel-varnish) - Some concepts in this repository was inspired by this package.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

43

—

FairBetter than 90% of packages

Maintenance37

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity77

Established project with proven stability

 Bus Factor1

Top contributor holds 96% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~143 days

Recently: every ~337 days

Total

18

Last Release

484d ago

Major Versions

0.3.1 → 1.0.02019-02-28

0.3.2 → 1.1.12019-06-14

1.5.0 → 2.0.02022-02-13

PHP version history (7 changes)0.1.0PHP ^5.5.9 || ^7.0 || ^7.1.3

1.0.0PHP ^7.1.3

1.2.0PHP ^7.2

1.4.0PHP ^7.3

1.5.0PHP ^7.3||^8.0

2.0.0PHP ^7.4|^8.0

2.2.0PHP ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5222595?v=4)[Richan Fongdasen](/maintainers/richan-fongdasen)[@richan-fongdasen](https://github.com/richan-fongdasen)

---

Top Contributors

[![richan-fongdasen](https://avatars.githubusercontent.com/u/5222595?v=4)](https://github.com/richan-fongdasen "richan-fongdasen (48 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (1 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (1 commits)")

---

Tags

laravellaravel-packagelaravel-varnishvarnishvarnish-cachelaravellaravel-packagevarnishvarnish-cache

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/richan-fongdasen-laravel-varnishable/health.svg)

```
[![Health](https://phpackages.com/badges/richan-fongdasen-laravel-varnishable/health.svg)](https://phpackages.com/packages/richan-fongdasen-laravel-varnishable)
```

###  Alternatives

[spatie/laravel-health

Monitor the health of a Laravel application

87411.3M153](/packages/spatie-laravel-health)[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[api-platform/laravel

API Platform support for Laravel

59156.3k11](/packages/api-platform-laravel)[simplestats-io/laravel-client

Analytics for Laravel. Track visitors, registrations, and payments. Discover which channels actually drive revenue, not just traffic. Server-side, GDPR compliant, ad-blocker proof.

5019.3k](/packages/simplestats-io-laravel-client)[fleetbase/core-api

Core Framework and Resources for Fleetbase API

1232.2k16](/packages/fleetbase-core-api)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
