afilina / Dont

:no_entry_sign: Small set of defensive programming utilities/traits for PHP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Don't

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

Infection MSI Packagist Packagist

Installation

composer require roave/dont

Usage

The package currently provides the following traits:

  • Dont\DontDeserialise
  • Dont\DontSerialise
  • 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.

About

:no_entry_sign: Small set of defensive programming utilities/traits for PHP

License:MIT License


Languages

Language:PHP 100.0%