rstgroup / http-method-override
HTTP method override service
Installs: 8 186
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 7
Forks: 2
Open Issues: 1
Requires
- php: >=5.6
- psr/container: ^1.0
Requires (Dev)
- http-interop/http-middleware: ^0.4.1
- php-middleware/double-pass-compatibility: ^1.0
- phpunit/phpunit: ^5.7.25 || ^6.0
- psr/http-message: ^1.0
- zendframework/zend-diactoros: ^1.3.3
- zendframework/zend-eventmanager: ^2.4 || ^3.0
- zendframework/zend-http: ^2.4
- zendframework/zend-modulemanager: ^2.4
- zendframework/zend-mvc: ^2.4 || ^3.0
Suggests
- http-interop/http-middleware: To use rstgroup/http-method-override as middleware
- php-middleware/double-pass-compatibility: To use rstgroup/http-method-override as middleware
- psr/http-message: To use rstgroup/http-method-override as middleware
- zendframework/zend-eventmanager: To use rstgroup/http-method-override as ZF module
- zendframework/zend-http: To use rstgroup/http-method-override as ZF module
- zendframework/zend-modulemanager: To use rstgroup/http-method-override as ZF module
- zendframework/zend-mvc: To use rstgroup/http-method-override as ZF module
This package is not auto-updated.
Last update: 2024-11-19 04:10:52 UTC
README
HTTP method override service
This 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 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):
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 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.