An open API service indexing awesome lists of open source software.

https://github.com/dmt-software/auth-middleware

Authentication and authorization middleware for psr-7 request
https://github.com/dmt-software/auth-middleware

authentication psr-7

Last synced: 3 months ago
JSON representation

Authentication and authorization middleware for psr-7 request

Awesome Lists containing this project

README

          

# Auth-middleware

[![Build Status](https://travis-ci.org/dmt-software/auth-middleware.svg?branch=master)](https://travis-ci.org/dmt-software/auth-middleware)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/dmt-software/auth-middleware/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/dmt-software/auth-middleware/?branch=master)
[![Code Coverage](https://scrutinizer-ci.com/g/dmt-software/auth-middleware/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/dmt-software/auth-middleware/?branch=master)

## Install
`composer require dmt-software/auth-middleware`

## Usage

### Example using GuzzleHttp\Client

```php
setHandler(new CurlHandler());
$stack->push(Middleware::mapRequest(new AuthorizationMiddleware(new ApiToken('abc123abc123'))));

$client = new Client([
'handler' => $stack
]);

$response = $client->get('https://api.localhost.dev'); // api token is added before the request is sent.

```