Download the PHP package vandarpay/exception-monitoring without Composer
On this page you can find all versions of the php package vandarpay/exception-monitoring. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download vandarpay/exception-monitoring
More information about vandarpay/exception-monitoring
Files in vandarpay/exception-monitoring
Package exception-monitoring
Short Description Vandar Exception Monitoring Laravel Package
License MIT
Informations about the package exception-monitoring
Vandar Exception Monitoring Laravel Package
We need to define keys for each important section of the service.
When an exception occurs in a section, we need to add related key to redis and set a specific ttl to automatically remove the keys.
Also, need an api with dynamic parameter for keys and return related response. api return 500 if the key exists in redis and 200 otherwise.
we must prepare some functionality that get key of important section and ttl from services and this package must provide a dynamic route with dynamic parameter by the given key.
Requirement
- Redis
- PHP redis extension
Installation
composer
you can publish config file:
Usage
Set key on redis
Here's a quick example:
the default ttl for each key is 300s. you can change that in config/exception-monitoring.php
. or you can pass ttl as second argument in set
function:
Calling Api for getin Status of mapped sections
there is a route with this pattern /api/exception-monitoring/{key}
.
for security and privacy you must send X-TOKEN
header with value set in config with token
key name.
make sure in config bellow key is set:
simply you can set EXCEPTION_MONITORING_TOKEN
in .env
file.
for example if you call https://your-domain.com/api/exception-monitoring/mandate-store
and,
if key exists in redis you will get bellow response:
or if key not exists in redis you will get bellow response:
and if key X-TOKEN
header not exists or invalid you will get bellow response:
Remove key from redis manually
you can remove key from redis manually like bellow:
License
The MIT License (MIT). Please see License File for more information.