https://github.com/yohn/e
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/yohn/e
- Owner: Yohn
- License: mit
- Created: 2024-08-18T01:00:33.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-11-22T11:37:43.000Z (over 1 year ago)
- Last Synced: 2025-08-19T01:22:53.765Z (10 months ago)
- Language: PHP
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Error Handling
An internal error handler and error logger.
## Yohns\Core\E
```php
include 'vendor/autoload.php';
use Yohns\Core\E;
E::initiate([
// the directory to store the error logs in.
'dir' => __DIR__.'/logs',
// default to display the errors
'display' => true,
// what variables to store
'store' => [
// if any $_POST variable is set
'_POST',
// if any $_FILES variable is set
'_FILES',
// if any $_GET variable is set
'_GET',
// if any $_COOKIE variable is set, default this is not saved
//'_COOKIE',
// if any $_SESSION variable is set, default this is not saved
//'_SESSION'
],
]);
set_error_handler('Yohns\Core\E::errHandler');
set_exception_handler('Yohns\Core\E::excHandler');
```
## Yohns\Core\Err
```php
include 'vendor/autoload.php';
use Yohns\Core\Err;
try {
throw new Err("This is a custom error message.");
} catch (Err $e) {
echo $e->getDetailedMessage();
}
```