icanhazstring / optimus-middleware
PSR-15/PSR-7 compliant middleware using jenssegers/optimus
v1.0
2018-05-20 16:19 UTC
Requires
- php: ^7.1
- jenssegers/optimus: ^0.2.3
- psr/container: ^1.0
- psr/http-message: ^1.0
- psr/http-server-middleware: ^1.0
Requires (Dev)
- phpstan/phpstan: ^0.9.2
- phpunit/phpunit: ^7.1
- squizlabs/php_codesniffer: ^3.2
- zendframework/zend-diactoros: ^1.7
This package is auto-updated.
Last update: 2024-10-26 03:02:24 UTC
README
PSR-15 compliant middleware using jenssegers/optimus
Install
You can install the optimus-middleware library with composer:
$ composer require icanhazstring/optimus-middleware
Configuration
General dependencies
For the middleware to work, your Container
needs a dependency to Optimus
.
You need to provide an instance with the configuration you need.
How to configure see: https://github.com/jenssegers/optimus
Using expressive
Include the OptimusConfigProvider
inside your config/config.php
:
$aggregator = new ConfigAggregator([ ... \icanhazstring\Middleware\OptimusConfigProvider::class, ... ]);
Make sure the OptimusConfigProvider
is included before your autoload files!
Change decoded attributes
If you want to change the attributes the middleware should decode, simply provide the
OptimusMiddleware::CONFIG_KEY
inside your autoload configuration.
return [ \icanhazstring\Middleware\OptimusMiddleware::CONFIG_KEY => ['id'] ];