PHPackages                             roave/dont - 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. roave/dont

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

roave/dont
==========

A small set of traits that can be used to prevent misuse of your objects

1.6.0(3y ago)399257.4k↓33.3%21[6 issues](https://github.com/Roave/Dont/issues)[4 PRs](https://github.com/Roave/Dont/pulls)3MITPHPPHP ~8.0.0 || ~8.1.0 || ~8.2.0CI passing

Since Mar 16Pushed 1mo ago11 watchersCompare

[ Source](https://github.com/Roave/Dont)[ Packagist](https://packagist.org/packages/roave/dont)[ Docs](https://github.com/Roave/Dont)[ RSS](/packages/roave-dont/feed)WikiDiscussions 1.7.x Synced 1mo ago

READMEChangelog (7)Dependencies (2)Versions (20)Used By (3)

Don't
=====

[](#dont)

`roave/dont` is a small PHP package aimed at enforcing good practices when it comes to designing [defensive code](https://ocramius.github.io/extremely-defensive-php/).

[![Infection MSI](https://camo.githubusercontent.com/00202a7c1b6de7960280711910f1cb2bf3e71a7eb7f1df7adcb54384c9190cce/68747470733a2f2f62616467652e737472796b65722d6d757461746f722e696f2f6769746875622e636f6d2f526f6176652f446f6e742f312e322e78)](https://infection.github.io)[![Packagist](https://camo.githubusercontent.com/10674ba87870c38a5234972dee1bc4e0eb4430f993fe915aa44afde10c0fffcd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f726f6176652f646f6e742e737667)](https://packagist.org/packages/roave/dont)[![Packagist](https://camo.githubusercontent.com/c531ff62dbc0014c434bb710f28b9bd45cdf12b96a9d0ee2f4d7bcc012f53203/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f767072652f726f6176652f646f6e742e737667)](https://packagist.org/packages/roave/dont)

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

[](#installation)

```
composer require roave/dont
```

Usage
-----

[](#usage)

The package currently provides the following traits:

- [`Dont\DontDeserialise`](docs/DontDeserialise.md)
- [`Dont\DontSerialise`](docs/DontSerialise.md)
- [`Dont\DontClone`](docs/DontClone.md)
- [`Dont\DontGet`](docs/DontGet.md)
- [`Dont\DontSet`](docs/DontSet.md)
- [`Dont\DontCall`](docs/DontCall.md)
- [`Dont\DontCallStatic`](docs/DontCallStatic.md)
- [`Dont\DontToString`](docs/DontToString.md)
- [`Dont\JustDont`](docs/JustDont.md)
- [`Dont\DontInstantiate`](docs/DontInstantiate.md)

Usage is straightforward:

```
use Dont\DontSerialise;

class MyClass
{
    use DontSerialise;
}

serialize(new MyClass); // will throw an exception
```

###  Health Score

59

—

FairBetter than 99% of packages

Maintenance59

Moderate activity, may be stable

Popularity51

Moderate usage in the ecosystem

Community32

Small or concentrated contributor base

Maturity81

Battle-tested with a long release history

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~121 days

Recently: every ~148 days

Total

14

Last Release

1043d ago

PHP version history (4 changes)1.0.0PHP ^7.1

1.2.0PHP 8.0.\*

1.5.0PHP 8.0.\* || 8.1.\*

1.6.0PHP ~8.0.0 || ~8.1.0 || ~8.2.0

### Community

Maintainers

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

![](https://www.gravatar.com/avatar/2734194006e4987a8e12379a63b4f6c0a4478b5818ea7ce677499b1f714a92d2?d=identicon)[asgrim](/maintainers/asgrim)

![](https://www.gravatar.com/avatar/7140a8c7b834b07674c6bd74d6cb75792522ceba17dfb1f347489083a0ba1c48?d=identicon)[malukenho](/maintainers/malukenho)

---

Top Contributors

[![Ocramius](https://avatars.githubusercontent.com/u/154256?v=4)](https://github.com/Ocramius "Ocramius (74 commits)")[![renovate[bot]](https://avatars.githubusercontent.com/in/2740?v=4)](https://github.com/renovate[bot] "renovate[bot] (55 commits)")[![asgrim](https://avatars.githubusercontent.com/u/496145?v=4)](https://github.com/asgrim "asgrim (15 commits)")[![lexidor](https://avatars.githubusercontent.com/u/31805625?v=4)](https://github.com/lexidor "lexidor (10 commits)")[![afilina](https://avatars.githubusercontent.com/u/199835?v=4)](https://github.com/afilina "afilina (4 commits)")[![OskarStark](https://avatars.githubusercontent.com/u/995707?v=4)](https://github.com/OskarStark "OskarStark (3 commits)")[![frankvanhest](https://avatars.githubusercontent.com/u/2206481?v=4)](https://github.com/frankvanhest "frankvanhest (3 commits)")[![staabm](https://avatars.githubusercontent.com/u/120441?v=4)](https://github.com/staabm "staabm (1 commits)")[![vudaltsov](https://avatars.githubusercontent.com/u/2552865?v=4)](https://github.com/vudaltsov "vudaltsov (1 commits)")[![azjezz](https://avatars.githubusercontent.com/u/29315886?v=4)](https://github.com/azjezz "azjezz (1 commits)")[![BackEndTea](https://avatars.githubusercontent.com/u/14289961?v=4)](https://github.com/BackEndTea "BackEndTea (1 commits)")[![danizord](https://avatars.githubusercontent.com/u/1850941?v=4)](https://github.com/danizord "danizord (1 commits)")[![fancyweb](https://avatars.githubusercontent.com/u/3658119?v=4)](https://github.com/fancyweb "fancyweb (1 commits)")[![Great-Antique](https://avatars.githubusercontent.com/u/1128310?v=4)](https://github.com/Great-Antique "Great-Antique (1 commits)")[![kunicmarko20](https://avatars.githubusercontent.com/u/13528674?v=4)](https://github.com/kunicmarko20 "kunicmarko20 (1 commits)")

---

Tags

defensive programmingstrictness

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/roave-dont/health.svg)

```
[![Health](https://phpackages.com/badges/roave-dont/health.svg)](https://phpackages.com/packages/roave-dont)
```

###  Alternatives

[inc2734/wp-breadcrumbs

A library for WordPress breadcrumbs.

1543.1k1](/packages/inc2734-wp-breadcrumbs)

PHPackages © 2026

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