oshco / db-exceptions-logger
A component which is used to log exceptions to database.
Installs: 571
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/oshco/db-exceptions-logger
Requires
- php: >=8.0
- webfiori/framework: v3.0.0-Beta.29
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.86
- phpunit/phpunit: ^10
README
A WebFiori framework extension which is used to log exceptions to database. The library currently supports SQL Server only.
Configuration
- Add dependency
- Initialize database
- Set errors handler
First, include this library in your project by adding the following dependency:
oshco/db-exceptions-logger
To initialize the table which is used to store exceptions, run following command:
php webfiori run-query --schema="oshco\database\logger\ExceptionsDB" --connection=<your-connection>
Replace your-connection
with the database connection to be used by the class. Note that the class will try to use a connection with the name exceptions-logger
if no connection provided.
To set errors handler, place following code in any of the initialization files:
\webfiori\error\Handler::registerHandler(new \oshco\handler\DatabaseErrHandler(new oshco\database\logger\ExceptionsDB()));