You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+30Lines changed: 30 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,6 +33,36 @@ An error handler for PHP.
33
33
</tbody>
34
34
</table>
35
35
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).
0 commit comments