PHPackages                             green-turtle/content-encoding - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. green-turtle/content-encoding

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

green-turtle/content-encoding
=============================

1.0.0(2y ago)0693PHPPHP ^8.1.0

Since Dec 12Pushed 2y ago2 watchersCompare

[ Source](https://github.com/GreenTurtleTech/laravel-content-encoding)[ Packagist](https://packagist.org/packages/green-turtle/content-encoding)[ RSS](/packages/green-turtle-content-encoding/feed)WikiDiscussions main Synced yesterday

READMEChangelog (1)Dependencies (6)Versions (2)Used By (0)

Laravel Content Encoding Middleware
===================================

[](#laravel-content-encoding-middleware)

Middleware that encodes response content.

Reduces data sent out, reduces bandwidth used.

Installation
------------

[](#installation)

```
composer require green-turtle/content-encoding

```

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

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

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

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

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

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

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

934d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/67381?v=4)[Phil Sturgeon](/maintainers/philsturgeon)[@philsturgeon](https://github.com/philsturgeon)

![](https://www.gravatar.com/avatar/aee2ff8ab8a5dc8e25d2d59d9402f0395ab411fa46d99c25991857bcafba0639?d=identicon)[carnage](/maintainers/carnage)

![](https://www.gravatar.com/avatar/d2e97974be1030f8d2446744769198c26bb1050a02e594ae8d907e8aa408c7d1?d=identicon)[charjr](/maintainers/charjr)

---

Top Contributors

[![charjr](https://avatars.githubusercontent.com/u/102669158?v=4)](https://github.com/charjr "charjr (2 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/green-turtle-content-encoding/health.svg)

```
[![Health](https://phpackages.com/badges/green-turtle-content-encoding/health.svg)](https://phpackages.com/packages/green-turtle-content-encoding)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[spatie/laravel-export

Create a static site bundle from a Laravel app

674146.0k6](/packages/spatie-laravel-export)[moonshine/moonshine

Laravel administration panel

1.3k253.1k81](/packages/moonshine-moonshine)[api-platform/laravel

API Platform support for Laravel

58171.4k14](/packages/api-platform-laravel)[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)
