https://github.com/roave/dont
:no_entry_sign: Small set of defensive programming utilities/traits for PHP
https://github.com/roave/dont
Last synced: about 1 year ago
JSON representation
:no_entry_sign: Small set of defensive programming utilities/traits for PHP
- Host: GitHub
- URL: https://github.com/roave/dont
- Owner: Roave
- License: mit
- Created: 2016-10-11T02:22:45.000Z (over 9 years ago)
- Default Branch: 1.7.x
- Last Pushed: 2025-04-28T16:50:20.000Z (about 1 year ago)
- Last Synced: 2025-04-28T17:48:23.077Z (about 1 year ago)
- Language: PHP
- Homepage:
- Size: 215 KB
- Stars: 399
- Watchers: 12
- Forks: 21
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Don't
`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/).
[](https://infection.github.io)
[](https://packagist.org/packages/roave/dont)
[](https://packagist.org/packages/roave/dont)
## Installation
```sh
composer require roave/dont
```
## 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:
```php
use Dont\DontSerialise;
class MyClass
{
use DontSerialise;
}
serialize(new MyClass); // will throw an exception
```