Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rstgroup/http-method-override
HTTP method override PSR-7 middleware
https://github.com/rstgroup/http-method-override
http method-override middleware psr-7
Last synced: about 2 months ago
JSON representation
HTTP method override PSR-7 middleware
- Host: GitHub
- URL: https://github.com/rstgroup/http-method-override
- Owner: rstgroup
- License: bsd-3-clause
- Created: 2016-01-29T10:00:22.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2020-11-03T20:25:42.000Z (about 4 years ago)
- Last Synced: 2024-11-10T21:47:20.485Z (2 months ago)
- Topics: http, method-override, middleware, psr-7
- Language: PHP
- Homepage: http://rst.com.pl/
- Size: 20.5 KB
- Stars: 2
- Watchers: 7
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# http-method-override [![Build Status](https://travis-ci.org/rstgroup/http-method-override.svg?branch=master)](https://travis-ci.org/rstgroup/http-method-override)
HTTP method override serviceThis library allows you to override HTTP method using HTTP header ie. `X-HTTP-Method-Override`. Why? Because some clients
cannot send non-standard methods like ie. `LINK`. It can be used as PSR-7 middeware or Zend Framework 2 module.## Installation
```
composer require rstgroup/http-method-override
```Check suggested dependencies in [composer.json](composer.json) and add it to your dependencies.
You need to configure how it's possible to override methods. To do that you need to create/modify configuration provided
by service which must exists in your dependecy container (as `config` key):```php
return [
'rst_group' => [
'http_method_override' => [
'map' => [
'POST' => ['LINK', 'PUT'],
],
'override_headers' => [],
],
],
];
```It will add ability to use POST method as LINK or PUT. You can override it using given request:
```
POST http://example.com/page
X-HTTP-Method-Override: PUT
````override_headers` allow you to define own header to override.
### Specific installation for PSR-7 middeware
Use [Expressive Configuration Manager](https://github.com/mtymek/expressive-config-manager) to add library config.
After this you can enable middleware in your middleware-stack using `RstGroup\HttpMethodOverride\HttpMethodOverrideMiddleware`
service name in your container.### Specific installation for Zend Framework 2 & 3
Add module `RstGroup\HttpMethodOverride` to `application.config.php` file.