- Installation - how to register a plugin
- Configuration - how to configure
- Middlewares - cycle
- Playground - real examples
This plugin requires Apitte/Core library.
At first you have to register the main extension.
extensions: api: Apitte\Core\DI\ApiExtension
Secondly, add the
api: plugins: Apitte\Middlewares\DI\MiddlewaresPlugin:
You can configure a few options.
api: plugins: Apitte\Middlewares\DI\MiddlewaresPlugin: tracy: true autobasepath: true
tracy- Automatically register
Contributte\Middlewares\TracyMiddlewarewith priority 100.
autobasepath- Automatically register
Contributte\Middlewares\AutoBasePathMiddlewarewith priority 200.
By default, the
Apitte\Middlewares\ApiMiddleware is registered with priority 500. So you can add as many middlewares as you want.
This package is based on contributte/middlewares. You should register also middleware extension in your config file.
extensions: middlewares: Contributte\Middlewares\DI\MiddlewaresExtension api: Apitte\Core\DI\ApiExtension
After that you feel the power of the middlewares.
If you wanna add a another middleware, just register a class with appropriate tags.
services: m1: factory: App\Model\AppMiddleware1 tags: [middleware: [priority: <int>]]
I've made a repository with full applications for education.
Take a look: https://github.com/apitte/playground