<commit_before>Error API
=========

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. For this we provide the Error Api module where you can send all exceptions to your personal Error Api. If an exception happens on the customers website you will get a mail with the full stack and a slack notification (if configured).

### install

add to your composer.json

```
"luyadev/luya-module-errorapi" : "^1.0@dev",
```

add the module to your application config:

```
'modules' => [
	// ...
	'errorapi' => [
	    'class' => 'luya\luya\errorapi\Module',
	    'recipient' => ['<EMAIL>'],
	    'slackToken' => 'YOUR_SECRET_SLACK_TOKEN',
	],
]
```

Defined the recipients of the exception mail and configuration the slack channel, if you like to (removing the slack part will disabled slack notification).

### setup your website

In order to enable the above created error api for your website you just have to configure the default LUYA error handler in the config file in the component section of your Project:

```
'components' => [
	// ...
	'errorHandler' => [
		'class' => 'luya\web\ErrorHandler',
		'api' => 'https://example.com/errorapi', // where example is the domain you have setup error api above
		'transferException' => true',
	],
]
```<commit_msg>Update README.md (#1039)<commit_after>Error API Module
=========

For a strong and secure website, it is important to get access to all the errors and exceptions that occur in the background before your customer complain and make sure that it only happens once.

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).

### Module setup

add this line to your composer.json

```
"luyadev/luya-module-errorapi" : "^1.0@dev",
```

add the module to your application config:

```
'modules' => [
	// ...
	'errorapi' => [
	    'class' => 'luya\errorapi\Module',
	    'recipient' => ['<EMAIL>'],
	    'slackToken' => '<PASSWORD>',
	],
]
```

Defined the email of the recipient for the exceptions and configure the slack channel if needed to. 

> Removing the slack part will disabled slack notifications.

### Website setup

ITo enable the error api for your website, you need to configure the default LUYA error handler in the component section of your config file :

```
'components' => [
	// ...
	'errorHandler' => [
		'class' => 'luya\web\ErrorHandler',
		'api' => 'https://example.com/errorapi', // where example is the domain you have setup error api above
		'transferException' => true',
	],
]
```
{'fraction_non_alphanumeric': 0.11307166006481816, 'fraction_numerical': 0.0028808066258552397, 'mean_word_length': 3.9518716577540105, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 27, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4980634', 'n_tokens_mistral': 818, 'n_tokens_neox': 769, 'n_words': 356}