mlipienski / midas
PSR7 authorization middleware
Requires
- guzzlehttp/guzzle: ^6.5
- middlewares/utils: ^3.0
- psr/http-message: ^1.0
- psr/http-server-handler: ^1.0
- psr/http-server-middleware: ^1.0
- vlucas/phpdotenv: ^3.6
Requires (Dev)
- phpunit/phpunit: ^8.5
This package is auto-updated.
Last update: 2025-05-20 00:06:02 UTC
README
Midas Authorization is a PSR7-compliant middleware that aims to be both succinct and powerful.
Instalation
If you don't have composer, first install it by following the official docs at https://getcomposer.org/download/.
After you have installed composer, you can install this library in your project by running:
composer require mlipienski/midas
Concept
Midas Authorization works on a strategy-basis. This means it can check authorization against virtually any source, such as database, API and so-on. By exposing a simple Factory that takes a Strategy as first argument and a callable as the second, it allows you to write custom authorization checks without having to write a new Strategy.
Usage
Midas Authorization can be used as a middleware at any project that implements PSR7
// Slim microframework example $app->add( new Midas\AuthorizationMiddleware( Midas\Factories\StrategyFactory::use( Midas\Strategis\JWTStrategy::class, function ($credentials) { // your logic return true } ) ) );