richan-fongdasen/laravel-varnishable
最新稳定版本:2.3.0
Composer 安装命令:
composer require richan-fongdasen/laravel-varnishable
包简介
Simple and easy varnish integration in Laravel
README 文档
README
Laravel Varnishable
Simple and easy varnish integration in Laravel
Synopsis
This package offers easy ways to integrate your Laravel application with Varnish Cache.
Table of contents
Setup
Install the package via Composer :
$ 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.
Service Provider
Add the package service provider in your config/app.php
'providers' => [ // ... RichanFongdasen\Varnishable\ServiceProvider::class, ];
Alias
Add the package's alias in your config/app.php
'aliases' => [ // ... 'Varnishable' => RichanFongdasen\Varnishable\Facade::class, ];
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
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.
Credits
- spatie/laravel-varnish - Some concepts in this repository was inspired by this package.
License
The MIT License (MIT). Please see License File for more information.
richan-fongdasen/laravel-varnishable 适用场景与选型建议
richan-fongdasen/laravel-varnishable 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 30.45k 次下载、GitHub Stars 达 8, 最近一次更新时间为 2018 年 06 月 20 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「varnish」 「laravel」 「laravel-package」 「varnish-cache」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 richan-fongdasen/laravel-varnishable 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 richan-fongdasen/laravel-varnishable 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 richan-fongdasen/laravel-varnishable 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Varnish cache bundle for Symfony 2
Render content in fusion as esi:include
Speed up your TYPO3 installation: add Critical CSS (Above The Fold) inline, minify the HTML of your website, use subdomains as CDN to reduce page load, manage proxy-caching (e.g with Varnish) via page-properties.
A Laravel package for converting English numbers into Bangla digits, Bangla words, Bangla month names, and Bangla money format with an easy-to-use API.
Laravel table comments loader (part of Diplodocker project)
WordPress plugin to extend Varnish HTTP Purge to purge the cache on multiple backends.
统计信息
- 总下载量: 30.45k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 8
- 点击次数: 16
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-06-20