From 0feffc4b3866a5bf6eeea2f034473d8a176aa8ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Cobucci?= Date: Sun, 6 May 2018 23:34:01 +0200 Subject: [PATCH] Add info about usage of `assert()` --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index 617f3e18..e734efd9 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,20 @@ you can install it using [Composer](http://getcomposer.org). composer require lcobucci/di-builder ``` +### PHP Configuration + +In order to make sure that we're dealing with the correct data, we're using `assert()`, +which is a very interesting feature in PHP but not often used. The nice thing +about `assert()` is that we can (and should) disable it in production mode so +that we don't have useless statements. + +So, for production mode, we recommend you to set `zend.assertions` to `-1` in your `php.ini`. +For development you should leave `zend.assertions` as `1` and set `assert.exception` to `1`, which +will make PHP throw an [`AssertionError`](https://secure.php.net/manual/en/class.assertionerror.php) +when things go wrong. + +Check the documentation for more information: https://secure.php.net/manual/en/function.assert.php + ## Basic usage The usage is really simple, just trust the ```Lcobucci\DependencyInjection\Builder``` interface and