Download the PHP package oshco/db-exceptions-logger without Composer

On this page you can find all versions of the php package oshco/db-exceptions-logger. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package db-exceptions-logger

Database Exceptions Logger

A WebFiori framework extension that logs exceptions to a database with optional per-portal tracking. Currently supports SQL Server only.

Requirements

Installation

Setup

1. Create the database table

Run the migration to create the system_exceptions table:

2. Register the error handler

3. (Optional) Configure portal tracking

To associate exceptions with a specific portal, set a resolver callable:

The resolver is called when an exception occurs. It should return an int (portal ID) or null.

Usage

Querying logged exceptions

Entity properties

Each SystemException entity exposes:

Method Description
getId() Auto-increment ID
getHash() SHA-256 hash for deduplication
getDate() Timestamp when the exception was logged
getCode() Exception code
getClass() Class where the exception was thrown
getExceptionClass() The exception's fully-qualified class name
getMessage() Exception message
getLine() Line number
getUrl() Request URL
getParameters() Request parameters
getTrace() Stack trace
getPortalId() Portal ID (null if not set)

How It Works

When an exception occurs, DatabaseErrHandler:

  1. Captures exception details (code, class, message, file, line, stack trace)
  2. Captures request context (URL, parameters)
  3. Resolves the portal ID via the configured resolver (if set)
  4. Computes a SHA-256 hash for deduplication
  5. Stores everything in the system_exceptions table via ExceptionsRepository

Database Schema

Column Type Nullable Description
id INT (PK, identity) No Auto-increment ID
hash NVARCHAR(128) No SHA-256 hash for deduplication
date DATETIME2 No Timestamp (defaults to now)
code INT No Exception code
class VARCHAR(128) No Class where exception was thrown
exception_class VARCHAR(128) No Exception class name
message NVARCHAR(2048) No Exception message
line INT No Line number
url NVARCHAR(2048) Yes Request URL
parameters NVARCHAR(2048) Yes Request parameters
trace NVARCHAR(2048) No Stack trace
portal_id INT Yes Portal where exception occurred

Classes

Class Description
DatabaseErrHandler Error handler that captures exceptions and delegates storage to the repository. Supports a configurable portal ID resolver.
ExceptionsRepository Repository providing CRUD and filtering operations on the system_exceptions table.
SystemExceptionsTable Attribute-based MSSQL table schema definition.
SystemException Entity representing a logged exception record.
CreateSystemExceptionsTable Migration that creates the base table.
AlterSystemExceptionsAddPortalId Migration that adds the portal_id column (safe for existing tables).

Running Tests

Requires a running SQL Server instance:

License

MIT

Statistics Methods

All statistics methods accept optional $from and $to date parameters (ISO format) for filtering by date range.


All versions of db-exceptions-logger with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
webfiori/framework Version ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package oshco/db-exceptions-logger contains the following files

Loading the files please wait ...