Skip to content

Commit 2592463

Browse files
committed
added documentation, updated workflows
1 parent 364d45a commit 2592463

File tree

14 files changed

+181
-159
lines changed

14 files changed

+181
-159
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: "Continuous Integration"
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
tags:
8+
9+
jobs:
10+
ci:
11+
uses: laminas/workflow-continuous-integration/.github/workflows/continuous-integration.yml@1.x

.github/workflows/cs-tests.yml

Lines changed: 0 additions & 47 deletions
This file was deleted.

.github/workflows/docs-build.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: docs-build
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
8+
jobs:
9+
build-deploy:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Build Docs
13+
uses: dotkernel/documentation-theme/github-actions/docs@main
14+
env:
15+
DEPLOY_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/static-analysis.yml

Lines changed: 0 additions & 47 deletions
This file was deleted.

.github/workflows/unit-tests.yml

Lines changed: 0 additions & 48 deletions
This file was deleted.

README.md

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,19 @@ Logging Error Handler for DotKernel
1515

1616
[![SymfonyInsight](https://insight.symfony.com/projects/cf1f8d89-f230-4157-bc8b-7cce20c75454/big.svg)](https://insight.symfony.com/projects/cf1f8d89-f230-4157-bc8b-7cce20c75454)
1717

18-
1918
## Adding the error handler
2019

21-
* Add the composer package:
22-
23-
`composer require dotkernel/dot-errorhandler:^3.1`
20+
- Add the composer package:
2421

22+
`composer require dotkernel/dot-errorhandler:^3.3`
2523

26-
* Add the config provider
24+
- Add the config provider
2725
- in `config/config.php` add `\Dot\ErrorHandler\ConfigProvider`
2826
- in `config/pipeline.php` add `\Dot\ErrorHandler\ErrorHandlerInterface::class`
2927
+ the interface is used as an alias to keep all error handling related configurations in one file
3028
+ **IMPORTANT NOTE** there should be no other error handlers after this one (only before) because the other error handler will catch the error causing dot-errorhandler not to catch any error, we recommend using just one error handler unless you have an error-specific handler
3129

32-
* Configure the error handler as shown below
30+
- Configure the error handler as shown below
3331

3432
configs/autoload/error-handling.global.php
3533
```php
@@ -54,19 +52,17 @@ return [
5452
```
5553

5654
When declaring the `ErrorHandlerInterface` alias you can choose whether to log or not:
57-
* for logging use `LogErrorHandler`
58-
* for the simple zend expressive handler user `ErrorHandler`
55+
- for logging use `LogErrorHandler`
56+
- for the simple Zend Expressive handler user `ErrorHandler`
5957

6058
The class `Dot\ErrorHandler\ErrorHandler` is the same as the Zend Expressive error handling class
6159
the only difference being the removal of the `final` statement for making extension possible.
6260

63-
6461
The class `Dot\ErrorHandler\LogErrorHandler` is `Dot\ErrorHandler\ErrorHandler` with
6562
added logging support.
6663

67-
68-
As a note: both `LogErrorHandler` and `ErrorHandler` have factories declare in the
69-
package's ConfigProvider. If you need a custom ErrorHandler it must have a factory
64+
As a note: both `LogErrorHandler` and `ErrorHandler` have factories declared in the
65+
package's `ConfigProvider`. If you need a custom ErrorHandler it must have a factory
7066
declared in the config, as in the example.
7167

7268
Example:
@@ -98,5 +94,3 @@ return [
9894
```
9995

10096
Config examples can be found in this project's `config` directory.
101-
102-

SECURITY.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Security Policy
2+
3+
## Supported Versions
4+
5+
6+
| Version | Supported | PHP Version |
7+
|---------|--------------------|-----------------------------------------------------------------------------------------------------------------------|
8+
| 3.x | :white_check_mark: | ![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-errorhandler/3.3.2) |
9+
| <= 2.x | :x: | |
10+
11+
12+
## Reporting Potential Security Issues
13+
14+
If you have encountered a potential security vulnerability in this project,
15+
please report it to us at <security@dotkernel.com>. We will work with you to
16+
verify the vulnerability and patch it.
17+
18+
When reporting issues, please provide the following information:
19+
20+
- Component(s) affected
21+
- A description indicating how to reproduce the issue
22+
- A summary of the security vulnerability and impact
23+
24+
We request that you contact us via the email address above and give the
25+
project contributors a chance to resolve the vulnerability and issue a new
26+
release prior to any public exposure; this helps protect the project's
27+
users, and provides them with a chance to upgrade and/or update in order to
28+
protect their applications.
29+
30+
31+
## Policy
32+
33+
If we verify a reported security vulnerability, our policy is:
34+
35+
- We will patch the current release branch, as well as the immediate prior minor
36+
release branch.
37+
38+
- After patching the release branches, we will immediately issue new security
39+
fix releases for each patched release branch.

composer.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"config": {
2323
"sort-packages": true,
2424
"allow-plugins": {
25-
"dealerdirect/phpcodesniffer-composer-installer": true
25+
"dealerdirect/phpcodesniffer-composer-installer": true,
26+
"laminas/laminas-dependency-plugin": false
2627
}
2728
},
2829
"require": {
@@ -36,8 +37,8 @@
3637
},
3738
"require-dev": {
3839
"laminas/laminas-coding-standard": "^2.5",
39-
"mikey179/vfsstream": "^1.6",
40-
"phpunit/phpunit": "^10.0",
40+
"mikey179/vfsstream": "^1.6.7",
41+
"phpunit/phpunit": "^10.5",
4142
"vimeo/psalm": "^5.22"
4243
},
4344
"autoload": {

docs/book/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../README.md

docs/book/v3/configuration.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Configuration
2+
3+
Register `dot-errorhandler` in you project by adding `Dot\ErrorHandler\ConfigProvider::class` to your configuration aggregator (to `config/config.php` for example),
4+
and add `\Dot\ErrorHandler\ErrorHandlerInterface::class` (to `config/pipeline.php` for example) **as the outermost layer of the middleware** to catch all Exceptions
5+
6+
- Configure the error handler as shown below
7+
8+
configs/autoload/error-handling.global.php
9+
10+
```php
11+
<?php
12+
13+
use Dot\ErrorHandler\ErrorHandlerInterface;
14+
use Dot\ErrorHandler\LogErrorHandler;
15+
use Dot\ErrorHandler\ErrorHandler;
16+
17+
return [
18+
'dependencies' => [
19+
'aliases' => [
20+
ErrorHandlerInterface::class => LogErrorHandler::class,
21+
]
22+
23+
],
24+
'dot-errorhandler' => [
25+
'loggerEnabled' => true,
26+
'logger' => 'dot-log.default_logger'
27+
]
28+
];
29+
```
30+
31+
When declaring the `ErrorHandlerInterface` alias you can choose whether to log or not:
32+
- for the simple Zend Expressive handler user `ErrorHandler`
33+
- for logging use `LogErrorHandler`
34+
35+
The class `Dot\ErrorHandler\ErrorHandler` is the same as the Zend Expressive error handling class
36+
the only difference being the removal of the `final` statement for making extension possible.
37+
38+
The class `Dot\ErrorHandler\LogErrorHandler` is `Dot\ErrorHandler\ErrorHandler` with
39+
added logging support.
40+
41+
As a note: both `LogErrorHandler` and `ErrorHandler` have factories declared in the
42+
package's `ConfigProvider`. If you need a custom ErrorHandler it must have a factory
43+
declared in the config, as in the example.
44+
45+
Example:
46+
```php
47+
<?php
48+
49+
use Dot\ErrorHandler\ErrorHandlerInterface;
50+
use Custom\MyErrorHandler;
51+
use Custom\MyErrorHandlerFactory;
52+
53+
54+
return [
55+
'dependencies' => [
56+
'factories' => [
57+
MyErrorHandler::class => MyCustomHandlerFactory::class,
58+
],
59+
60+
'aliases' => [
61+
ErrorHandlerInterface::class => MyErrorHandler::class,
62+
]
63+
64+
],
65+
'dot-errorhandler' => [
66+
'loggerEnabled' => true,
67+
'logger' => 'dot-log.default_logger'
68+
]
69+
];
70+
```
71+
Config examples can be found in this project's `config` directory.

0 commit comments

Comments
 (0)