PHPackages                             leverage-php/encoder - 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. leverage-php/encoder

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

leverage-php/encoder
====================

DI friendly wrappers for common encoders.

v1.1.1(1y ago)03.9k↑160%1MITPHP

Since Aug 21Pushed 1y agoCompare

[ Source](https://github.com/leverage-php/encoder)[ Packagist](https://packagist.org/packages/leverage-php/encoder)[ RSS](/packages/leverage-php-encoder/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (7)Used By (1)

Encoder
=======

[](#encoder)

DI friendly + best practice encode/decode.

Best practice such as always setting assoc = true for json\_decode.

DI friendly to make it easier to test your code. You can test what happens on specific encode/decode errors without having to craft input that causes them.

Just mock the Encoder and have it behave the way you want to test.

Encoder vs Trait
----------------

[](#encoder-vs-trait)

There is no behavioural difference between the Encoder and the Trait.

Use the Encoder version for any service class. This let's you mock it and thus mock encode/decode issues without having to craft inputs that produce them.

Use the Trait when you need the same functionality in a data class.

Dev
---

[](#dev)

This repo assumes you have a suitable version of Docker available.

Copy `.env.dist` to `.env`. It's very unlikely you'll need to update these values.

Run `./bin/composer install`.

The standard Leverage Toolchain scripts are available in `./vendor/bin/`.

Make sure to run `./vendor/bin/verify` before you push.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance32

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% 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 ~170 days

Total

5

Last Release

684d ago

Major Versions

v0.2 → v1.0.02022-08-22

### Community

Maintainers

![](https://www.gravatar.com/avatar/752c7d73a901e4127eb085e33a61da585b8616b0effa0e9602fb52ea1d33c012?d=identicon)[avfletch](/maintainers/avfletch)

---

Top Contributors

[![yevhen-minenko](https://avatars.githubusercontent.com/u/103666907?v=4)](https://github.com/yevhen-minenko "yevhen-minenko (4 commits)")[![avfletch](https://avatars.githubusercontent.com/u/25877316?v=4)](https://github.com/avfletch "avfletch (2 commits)")

### Embed Badge

![Health badge](/badges/leverage-php-encoder/health.svg)

```
[![Health](https://phpackages.com/badges/leverage-php-encoder/health.svg)](https://phpackages.com/packages/leverage-php-encoder)
```

###  Alternatives

[dedi/sylius-seo-plugin

Sylius SEO plugin by Dedi.

28138.9k](/packages/dedi-sylius-seo-plugin)[flownative/neos-compressor

Output compression for Neos

1679.6k](/packages/flownative-neos-compressor)[swoole/zmq

ZeroMQ bindings for Swoole.

373.3k](/packages/swoole-zmq)

PHPackages © 2026

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