Download the PHP package shellrent/kraken-client without Composer
On this page you can find all versions of the php package shellrent/kraken-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package kraken-client
kRAKEN is an application for tracking and managing errors issued by external applications
This library provides a PHP
client API to facilitate calls to kRAKEN and an integration for the Laravel and Phalcon frameworks
The integrations add an ExceptionHandler, which carries out a complete report of unhandled exceptions and a Logger, which allows you to use the kRAKEN system for receiving and archiving log messages
Table of Contents
- Get Started
- Laravel Integration
- Integration
- ExceptionHandler Usage
- Logger Usage
- Customization
- Phalcon Integration
- Integration
- ExceptionHandler Usage
- Logger Usage
- Customization
Get Started
Requires PHP 8.1+
First, install Kraken Client via the Composer package manager:
Then interact with kRAKEN's API to send a report:
To generate a standard report starting from an exception, simply use the specific ReportBuilder
method:
Laravel
Requires Laravel 10.x
Laravel 9.x
Previous or later versions have not yet been tested
use on other versions is possible at your own risk
There is an integration with the Laravel framework
The Laravel package provides an ExceptionHandler
and registers the client API
and a psr style logger in the service container
Integration (Laravel)
To make the package work, you need to add the following settings to the .env
file:
To be able to send reports via queue you must specify the name of the queue to use in the .env
file, you can use the "default" value to use the standard queue
It is possible to test the connection to kraken and that the configurations are correct, using the command:
ExceptionHandler Usage (Laravel)
To enable exception reporting via the Exception Handler, you need to set the ExceptionHandler in the file bootrstrap/app.php
, overriding the current configuration:
It is possible to decide on which environments to activate the sending of reports by modifying enabled_envs
in the config file; by default only the production environment is enabled
By default the package does not send the information of the logged in user, they can be added by setting user_report_builder
in the configuration file, with a callable that returns this information
For more details see laravel customization
Logger Usage (Laravel)
It is possible to send single reports and logs via KrakenLogger using its Facade:
Instead, to use kraken through the Laravel logging system, you can add kraken as a custom channel in the config/logging.php
configuration file
It can also be added to the stack channel along with other channels
The kraken log channel can be used as a replacement for the ExceptionHandler, simply set 'report_exceptions' => true
in the configuration
WARNING
Use the ExceptionHandler and the log channel with set
'report_exceptions' => true
at the same times, duplicates the reports sent in case of an exception
Customization (Laravel)
To be able to modify the configuration you must first publish it via the command:
From the file created in config/kraken.php
you can edit:
- The code of the standard modules used by the framework
- The environments that trigger the ExceptionHandler
- The type code and builder class of an exception report
- The type code and builder class of an log report
- Signed in user information
For more details see the configuration file
Phalcon
Requires Phalcon 5.1
Previous or later versions have not yet been tested
use on other versions is possible at your own risk
There is an integration with the Phalcon framework
The integration with Phalcon provides an ExceptionHandler
and allows you to obtain the configuration
and a psr style logger
via the DI container of the framework
Integration (Phalcon)
To make the package work, you need to add the following settings to the .env
file:
ExceptionHandler Usage (Phalcon)
To send exception reports it is necessary to integrate the ExceptionHandler provided in the phalcon package with the one used by the application
It is possible to decide on which environments to activate the sending of reports, passing the collections of environments to the ExceptionHandler. By default the activated environment is production
The handler handles both exceptions and php errors
You can add session parts to the report via the addSessionKey
method
Furthermore, it is possible to hide specific information in the report by passing the key or the value that identifies it. Useful if sensitive data is present in $_SERVER
or other collections
By default the package does not send the information of the logged in user, they can be added by setting userDataGetter
property in the configuration object, with a callable that returns this information
For more details see phalcon customization
Logger Usage (Phalcon)
It is possible to send single reports and logs via KrakenLogger using KrakenService
:
Customization (Phalcon)
It is not necessary for correct working, but in order to customize the behavior of the package, the services need to be registered in the DI
The config object can be customized for change:
- The type code and builder class of an exception report
- The builder class of an php error report
- The type code and builder class of an log report
- Signed in user information
For more details see the configuration class