sgmarketplace/slim-core

This package is abandoned and no longer maintained. No replacement package was suggested.

Core utility classes for Slim framework projects

2.1.3 2015-10-26 16:50 UTC

This package is not auto-updated.

Last update: 2016-10-11 11:59:33 UTC


README

Slim core utility classes which can be re-used across microservices.

Installation

composer require sgmarketplace/slim-core

Documentation

SgSlimCore\Middleware\Json

A simple middleware that adds content-type to the response for a request that is considered an "api" request

SgSlimCore\Middleware\Auth

A simple middleware that only allows API path requests which have a valid JWT. This middleware requires a JWT service to verify logged-in status. A JWT service can be generated by using the SgSlimCore\Factory\Jwt factory.

SgSlimCore\Factory\TokenDecoder

A service factory which returns the OAuth2 library's decoder class configured with the public key (specified at $config['sg_slim_core']['jwt']['public_key_file']) opened in memory.

SgSlimCore\Factory\Jwt

A service factory which returns the OAuth2 library's decoded JWT (generated from the request's Authorization header) This factory requires the following configuration to be present on the \Slim\Slim $app level.

'sg_slim_core' => [
    'token_decoder' => 'name_of_the_token_decoder_service',
    'jwt' => [
        'public_key_file' => 'path/to/public/key.pem',
        'service_name' => 'name_of_this_service',
    ]
]