Skip to content

Commit 491ad27

Browse files
committed
Updated README.md.
1 parent 3984bb7 commit 491ad27

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,36 @@ An error handler for PHP.
3333
</tbody>
3434
</table>
3535

36+
PHP is a great language, however is has some quirks. One of them is that PHP has two mechanisms for signaling errors: exceptions and warnings. The following code will by default not raise an exception:
37+
```php
38+
$handle = fopen('no-such-file.txt', 'r');
39+
```
40+
It will generate a waring (which is most like to be suppressed) and return false.
41+
42+
This library will throw exceptions in case like above instead of generating warnings.
43+
44+
# Manual
45+
46+
Add the following code at the beginning of your PHP script to throw exceptions (when possible) when a PHP warning,
47+
error, or notice occurs.
48+
49+
```php
50+
use SetBased\ErrorHandler\ErrorHandler;
51+
52+
$handler = new ErrorHandler();
53+
$handler->registerErrorHandler();
54+
```
55+
56+
# Installation
57+
58+
This package can be installed using composer:
59+
```sh
60+
composer require setbased/error-handler
61+
```
62+
63+
Or you can obtain the sources at [GitHub](https://github.com/SetBased/php-error-handler).
64+
65+
3666
License
3767
=======
3868

0 commit comments

Comments
 (0)