Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added documentation for v3 #20

Merged
merged 11 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: "Continuous Integration"

on:
pull_request:
push:
branches:
tags:

jobs:
ci:
uses: laminas/workflow-continuous-integration/.github/workflows/[email protected]
47 changes: 0 additions & 47 deletions .github/workflows/cs-tests.yml

This file was deleted.

16 changes: 16 additions & 0 deletions .github/workflows/docs-build.yml
alexmerlin marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: docs-build

on:
release:
types: [published]
workflow_dispatch:

jobs:
build-deploy:
runs-on: ubuntu-latest
steps:
- name: Build Docs
uses: dotkernel/documentation-theme/github-actions/docs@main
env:
DEPLOY_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47 changes: 0 additions & 47 deletions .github/workflows/static-analysis.yml

This file was deleted.

48 changes: 0 additions & 48 deletions .github/workflows/unit-tests.yml

This file was deleted.

93 changes: 43 additions & 50 deletions README.md
alexmerlin marked this conversation as resolved.
Show resolved Hide resolved
alexmerlin marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -13,82 +13,75 @@

[![SymfonyInsight](https://insight.symfony.com/projects/dce88959-bd29-40ef-b1e7-d12815145438/big.svg)](https://insight.symfony.com/projects/dce88959-bd29-40ef-b1e7-d12815145438)


Middleware for setting and overwriting custom response headers.

## Requirements

### Requirements
- PHP >= 8.1

### Installation
## Installation

Run the following command in your project root directory

composer require dotkernel/dot-response-header


Next, register the package's `ConfigProvider` to your application config.

Dot\ResponseHeader\ConfigProvider::class,


Note : Make sure to register the package under the `// DK packages` section.

After registering the package, add it to the middleware stack in ``config/pipeline.php`` after `$app->pipe(RouteMiddleware::class);`
After registering the package, add it to the middleware stack in `config/pipeline.php` after `$app->pipe(RouteMiddleware::class);`

$app->pipe(RouteMiddleware::class);
$app->pipe(\Dot\ResponseHeader\Middleware\ResponseHeaderMiddleware::class);


Create a new file ``response-header.global.php`` in ``config/autoload`` with the below configuration array :

```
<?php
return [
'dot_response_headers' => [
'*' => [
'CustomHeader1' => [
'value' => 'CustomHeader1-Value',
'overwrite' => true,
Create a new file `response-header.global.php` in `config/autoload` with the below configuration array :

<?php
return [
'dot_response_headers' => [
'*' => [
'CustomHeader1' => [
'value' => 'CustomHeader1-Value',
'overwrite' => true,
],
'CustomHeader2' => [
'value' => 'CustomHeader2-Value',
'overwrite' => false,
],
],
'CustomHeader2' => [
'value' => 'CustomHeader2-Value',
'overwrite' => false,
'home' => [
'CustomHeader' => [
'value' => 'header3',
]
],
],
'home' => [
'CustomHeader' => [
'value' => 'header3',
]
],
'login' => [
'LoginHeader' => [
'value' => 'LoginHeader-Value',
'overwrite' => false
]
],
]
];
```
'login' => [
'LoginHeader' => [
'value' => 'LoginHeader-Value',
'overwrite' => false
]
],
]
];

Because headers are matched with route names, we can have custom response headers for every request, by defining new headers under the ``*`` key.
Because headers are matched with route names, we can have custom response headers for every request, by defining new headers under the `*` key.

All headers under ``*`` will be set for every response.
All headers under `*` will be set for every response.

To add response headers for a specific set of routes, define a new array using the route name as the array key.

Example :
```
'dot_response_headers' => [
'user' => [
'UserCustomHeader' => [
'value' => 'UserCustomHeader-Value',
'overwrite' => false
]
],
]
Example :

// This will set a new header named UserCustomHeader with the UserCustomHeader-Value value for any route name matching 'user'
```
'dot_response_headers' => [
'user' => [
'UserCustomHeader' => [
'value' => 'UserCustomHeader-Value',
'overwrite' => false
]
],
]

// This will set a new header named UserCustomHeader with the UserCustomHeader-Value value for any route name matching 'user'

To overwrite an existing header use ``overwrite => true``.
To overwrite an existing header use `overwrite => true`.
38 changes: 38 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Security Policy

## Supported Versions


| Version | Supported | PHP Version |
|---------|--------------------|---------------------------------------------------------------------------------------------------------------------|
| 3.x | :white_check_mark: | ![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-response-header/3.2.3) |

alexmerlin marked this conversation as resolved.
Show resolved Hide resolved

## Reporting Potential Security Issues

If you have encountered a potential security vulnerability in this project,
please report it to us at <[email protected]>. We will work with you to
verify the vulnerability and patch it.

When reporting issues, please provide the following information:

- Component(s) affected
- A description indicating how to reproduce the issue
- A summary of the security vulnerability and impact

We request that you contact us via the email address above and give the
project contributors a chance to resolve the vulnerability and issue a new
release prior to any public exposure; this helps protect the project's
users, and provides them with a chance to upgrade and/or update in order to
protect their applications.


## Policy

If we verify a reported security vulnerability, our policy is:

- We will patch the current release branch, as well as the immediate prior minor
release branch.

- After patching the release branches, we will immediately issue new security
fix releases for each patched release branch.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"php": "~8.1.0 || ~8.2.0 || ~8.3.0",
"mezzio/mezzio-router": "^3.16",
"psr/http-client": "^1.0",
"psr/http-message": "^1.0 || ^2.0"
"psr/http-message": "^2.0"
},
"require-dev": {
"laminas/laminas-coding-standard": "^2.5",
Expand Down
1 change: 1 addition & 0 deletions docs/book/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
../../README.md
Loading