zephir / luya-module-errorapi
To create strong and secure website its important to know all exceptions before your customer knows the exceptions and to make sure the exception happends only once.
Installs: 120
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 4
Forks: 3
Open Issues: 0
Type:luya-module
Requires
- nadar/parser: ^1.0
Requires (Dev)
- luyadev/luya-testsuite: ^2.0
- vlucas/phpdotenv: ^2.5
This package is auto-updated.
Last update: 2023-10-31 07:09:38 UTC
README
Error API Module
For a solid and secure website, it is important to get notified about all the errors and exceptions that occur. This helps prevent unnoticed repeating errors and keeps customers happy as they won't have to complain.
With the Error Api module, you can send all exceptions to your personal Error Api and get notify by email or Slack. If an exception occurs on the customer website, you will be notified with the full error stack and a slack notification will be sent (if configured).
Install Server
For the installation of modules Composer is required:
composer require luyadev/luya-module-errorapi
Configuration
After installation via Composer include the module to your configuration file within the modules section.
'modules' => [ // ... 'errorapi' => [ 'class' => 'luya\errorapi\Module', 'adapters' => [ [ 'class' => 'luya\errorapi\adapters\MailAdapter', 'recipient' => ['errors@example.com'], ], [ 'class' => 'luya\errorapi\adapters\SlackAdapter', 'token' => 'xyz.xyz.xyz.xyz', ], [ 'class' => 'luya\errorapi\adapters\SentryAdapter', 'token' => 'YOUR_SENTRY_USER_AUTH_TOKEN', 'organisation' => 'organisationslug', 'team' => 'teamslug', ] ], ], ]
Initialization
After successfully installation and configuration run the migrate, import and setup command to initialize the module in your project.
1.) Migrate your database.
./vendor/bin/luya migrate
2.) Import the module and migrations into your LUYA project.
./vendor/bin/luya import
It is very important to run the
./vendor/bin/luya migrate
and./vendor/bin/luya import
commands in order for these changes to take effect.
Setup Client
To enable the error api for your website you need to configure the default LUYA error handler in the component section of your config file with the current setup server (error api):
'components' => [ // ... 'errorHandler' => [ 'api' => 'https://example.com/errorapi', // where example is the domain you have setup error api above 'transferException' => true, ], ]