https://github.com/icanhazstring/optimus-middleware
PSR-15/PSR-7 compliant middleware using jenssegers/optimus
https://github.com/icanhazstring/optimus-middleware
expressive middleware optimus psr-15 psr-7
Last synced: 3 months ago
JSON representation
PSR-15/PSR-7 compliant middleware using jenssegers/optimus
- Host: GitHub
- URL: https://github.com/icanhazstring/optimus-middleware
- Owner: icanhazstring
- License: mit
- Created: 2018-05-20T13:51:25.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-05-20T16:20:05.000Z (about 7 years ago)
- Last Synced: 2025-02-06T08:30:46.681Z (5 months ago)
- Topics: expressive, middleware, optimus, psr-15, psr-7
- Language: PHP
- Homepage:
- Size: 9.77 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# expressive-optimus-middleware
PSR-15 compliant middleware using jenssegers/optimus[](https://travis-ci.org/icanhazstring/optimus-middleware)
## Install
You can install the *optimus-middleware* library with composer:
```bash
$ 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`:
```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.```php
return [
\icanhazstring\Middleware\OptimusMiddleware::CONFIG_KEY => ['id']
];
```