PHPackages                             prezly/forbid-serialization - 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. prezly/forbid-serialization

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

prezly/forbid-serialization
===========================

Micro-package with a handy trait to forbid serialization of specific class in PHP

v2.0.0(2y ago)1143.6k↓20.1%MITPHPPHP ^7.4||^8.0

Since Nov 2Pushed 2y ago4 watchersCompare

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

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

Prezly's ForbidSerialization
============================

[](#prezlys-forbidserialization)

Prezly's ForbidSerialization is a micro-package with a handy trait to forbid serialization of specific class in PHP.

This is because standard PHP `serialize()` function can serialize anything, even instances you'd never want to be serialized. So `ForbidSerialization`is just a nice easy way to *opt-out* whenever you do not *intentionally* want an object to be serialized (which should be the default in 99.99% of all cases).

See this awesome talk from Marco Pivetta on **Extremely Defensive PHP**. Specifically the part about serialization:

Usage
-----

[](#usage)

Usage is as simple as adding `use ForbidSerialization` to any class. Only make sure you do not override `__sleep()` or `__serialize()` methods.

```
use Prezly\ForbidSerialization\ForbidsSerialization;

class AmazonWebServicesIntegrationService {
    use ForbidsSerialization;

    // ...
}
```

Changelog
---------

[](#changelog)

- [Changelog](./CHANGELOG.md)

Credits
-------

[](#credits)

Brought to you with ❤️ by [Prezly](https://www.prezly.com/?utm_source=github&utm_campaign=slate).

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 64.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 ~1066 days

Total

2

Last Release

956d ago

Major Versions

v1.0.0 → v2.0.02023-10-05

PHP version history (2 changes)v1.0.0PHP &gt;=7.1

v2.0.0PHP ^7.4||^8.0

### Community

Maintainers

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

---

Top Contributors

[![e1himself](https://avatars.githubusercontent.com/u/370680?v=4)](https://github.com/e1himself "e1himself (11 commits)")[![marko-ogg](https://avatars.githubusercontent.com/u/15163962?v=4)](https://github.com/marko-ogg "marko-ogg (6 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/prezly-forbid-serialization/health.svg)

```
[![Health](https://phpackages.com/badges/prezly-forbid-serialization/health.svg)](https://phpackages.com/packages/prezly-forbid-serialization)
```

PHPackages © 2026

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