Skip to content
🚫 Small set of defensive programming utilities/traits for PHP
Branch: master
Clone or download
Latest commit a74fd73 Apr 16, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
src/Dont Add JustDont trait Mar 19, 2019
tests Add JustDont trait Mar 19, 2019
.scrutinizer.yml Added scrutinizer-ci config Oct 11, 2016
.travis.yml Added 7.2/7.3 travis builds Mar 10, 2019
LICENSE Adding MIT licence Oct 11, 2016 Slightly simplify readme Apr 16, 2019
infection.json.dist Added infection/infection to mutation test Oct 25, 2018
phpunit.xml.dist Link to local phpunit.xsd instead of a remote one Feb 8, 2019


roave/dont is a small PHP package aimed at enforcing good practices when it comes to designing defensive code.

Build Status Scrutinizer Code Quality Code Coverage Packagist Packagist


composer require roave/dont


The package currently provides the following traits:

  • Dont\DontDeserialise
  • Dont\DontSerialize
  • Dont\DontClone
  • Dont\DontGet
  • Dont\DontSet
  • Dont\DontCall
  • Dont\DontCallStatic
  • Dont\JustDont

Usage is straightforward:

use Dont\DontSerialise;

class MyClass
    use DontSerialise;

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

The same applies to DontDeserialise, but this time with unserialize().

Dont\JustDont includes other seven traits and is the recommended one to use.

You can’t perform that action at this time.