green-turtle/content-encoding
最新稳定版本:1.0.0
Composer 安装命令:
composer require green-turtle/content-encoding
包简介
README 文档
README
Middleware that encodes response content.
Reduces data sent out, reduces bandwidth used.
Installation
composer require green-turtle/content-encoding
Configuration
The defaults are set in config/content-encoding.php.
To publish a copy to your own config, use the following:
php artisan vendor:publish --tag="green-turtle-content-encoding"
Encode Unknown Types
Sometimes the Content-Type header may be missing.
You may specify in your config whether you still wish to try encoding data.
By default, it is set to false.
'encode_unknown_type' => false,
Allowed Types
These are the types of content allowed to be encoded.
Each type is a string that will be used as a regex pattern.
Example, any text format is acceptable:
'allowed_types' => [ '#^(text\/.*)(;.*)?$#' ]
Encoders
These are the encoders determine what encodings are supported.
The built-in Encoders are enabled by default:
'encoders' => [
Gzip::class,
Deflate::class,
]
You may create more by implementing the following interface:
GreenTurtle\Middleware\Encoder\ContentEncoder
Global Usage
To enable this middleware globally, add the following to your middleware array, found within app/Http/Kernel.php:
For example:
protected $middleware = [ // other middleware... \GreenTurtle\Middleware\ContentEncoding::class // other middleware... ];
统计信息
- 总下载量: 693
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2023-12-13