-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8c59ed9
commit adfd94e
Showing
7 changed files
with
117 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
name: "Continuous Integration" | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
tags: | ||
|
||
jobs: | ||
ci: | ||
uses: laminas/workflow-continuous-integration/.github/workflows/[email protected] | ||
name: "Continuous Integration" | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
tags: | ||
|
||
jobs: | ||
ci: | ||
uses: laminas/workflow-continuous-integration/.github/workflows/[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +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 }} | ||
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
../../README.md | ||
../../README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,57 @@ | ||
# Configuration | ||
|
||
## Requirements | ||
|
||
- PHP >= 8.1 | ||
|
||
## Register ConfigProvider | ||
|
||
Next, register the package's `ConfigProvider` to your application config. | ||
|
||
```php | ||
Dot\ResponseHeader\ConfigProvider::class, | ||
``` | ||
|
||
Note : Make sure to register the package under the `// DK packages` section. | ||
|
||
## Add the package to the middleware stack | ||
|
||
After registering the package, add it to the middleware stack in `config/pipeline.php` after `$app->pipe(RouteMiddleware::class);` | ||
|
||
```php | ||
$app->pipe(RouteMiddleware::class); | ||
$app->pipe(\Dot\ResponseHeader\Middleware\ResponseHeaderMiddleware::class); | ||
``` | ||
|
||
## Add configuration in autoload | ||
|
||
Create a new file `response-header.global.php` in `config/autoload` with the below configuration array : | ||
|
||
```php | ||
<?php | ||
return [ | ||
'dot_response_headers' => [ | ||
'*' => [ | ||
'CustomHeader1' => [ | ||
'value' => 'CustomHeader1-Value', | ||
'overwrite' => true, | ||
], | ||
'CustomHeader2' => [ | ||
'value' => 'CustomHeader2-Value', | ||
'overwrite' => false, | ||
], | ||
], | ||
'home' => [ | ||
'CustomHeader' => [ | ||
'value' => 'header3', | ||
] | ||
], | ||
'login' => [ | ||
'LoginHeader' => [ | ||
'value' => 'LoginHeader-Value', | ||
'overwrite' => false | ||
] | ||
], | ||
] | ||
]; | ||
``` | ||
# Configuration | ||
|
||
## Requirements | ||
|
||
- PHP >= 8.1 | ||
|
||
## Register ConfigProvider | ||
|
||
Next, register the package's `ConfigProvider` to your application config. | ||
|
||
```php | ||
Dot\ResponseHeader\ConfigProvider::class, | ||
``` | ||
|
||
Note : Make sure to register the package under the `// DK packages` section. | ||
|
||
## Add the package to the middleware stack | ||
|
||
After registering the package, add it to the middleware stack in `config/pipeline.php` after `$app->pipe(RouteMiddleware::class);` | ||
|
||
```php | ||
$app->pipe(RouteMiddleware::class); | ||
$app->pipe(\Dot\ResponseHeader\Middleware\ResponseHeaderMiddleware::class); | ||
``` | ||
|
||
## Add configuration in autoload | ||
|
||
Create a new file `response-header.global.php` in `config/autoload` with the below configuration array : | ||
|
||
```php | ||
<?php | ||
return [ | ||
'dot_response_headers' => [ | ||
'*' => [ | ||
'CustomHeader1' => [ | ||
'value' => 'CustomHeader1-Value', | ||
'overwrite' => true, | ||
], | ||
'CustomHeader2' => [ | ||
'value' => 'CustomHeader2-Value', | ||
'overwrite' => false, | ||
], | ||
], | ||
'home' => [ | ||
'CustomHeader' => [ | ||
'value' => 'header3', | ||
] | ||
], | ||
'login' => [ | ||
'LoginHeader' => [ | ||
'value' => 'LoginHeader-Value', | ||
'overwrite' => false | ||
] | ||
], | ||
] | ||
]; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# Installation | ||
|
||
Install dotkernel/dot-response-header by executing the following Composer command in your project directory: | ||
|
||
composer require dotkernel/dot-response-header | ||
# Installation | ||
|
||
Install dotkernel/dot-response-header by executing the following Composer command in your project directory: | ||
|
||
composer require dotkernel/dot-response-header |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# Overview | ||
|
||
`dot-response-header` is DotKernel's middleware for setting and overwriting custom response headers. | ||
# Overview | ||
|
||
`dot-response-header` is DotKernel's middleware for setting and overwriting custom response headers. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
# Usage | ||
|
||
Because headers are matched with route names, we can have custom response headers for every request, by defining new headers under the `*` key, in the configuration file `response-header.global.php`. | ||
|
||
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 | ||
|
||
```php | ||
'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`. | ||
# Usage | ||
|
||
Because headers are matched with route names, we can have custom response headers for every request, by defining new headers under the `*` key, in the configuration file `response-header.global.php`. | ||
|
||
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 | ||
|
||
```php | ||
'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`. |