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
- Host: GitHub
- URL: https://github.com/dmt-software/auth-middleware
- Owner: dmt-software
- License: mit
- Created: 2018-03-05T23:07:05.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2019-02-11T20:16:50.000Z (about 7 years ago)
- Last Synced: 2025-05-12T04:45:44.873Z (12 months ago)
- Topics: authentication, psr-7
- Language: PHP
- Size: 22.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Auth-middleware
[](https://travis-ci.org/dmt-software/auth-middleware)
[](https://scrutinizer-ci.com/g/dmt-software/auth-middleware/?branch=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.
```