Download the PHP package los/api-auth without Composer
On this page you can find all versions of the php package los/api-auth. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Please rate this library. Is it a good library?
Informations about the package api-auth
Api Auth
This library provides a PHP middleware for api authentication.
Installation
Usage
Using PSR-11 containers, use the provided factories and define factories for each requirement:
Then add the middleware to you pipeline:
If successful, the middleware will register a new Request attribute with the identity found, so you can know which identity is authorized in the request.
If using laminas, you can create a config/autoload/api-auth.global.php:
Strategies
Included:
- XApiKeyHeader: extracts the identity from the X-Api-Key header
- CustomHeader: extracts the identity from a custom header
- AuthorizationHeader: extracts the identity and credential from the Authorization header
- Aggregate: you can add as many strategies as you want, and it will return the first which succeeds
- Strategy interface to implement your own strategies
Authenticator
Included:
- ArrayAuthenticator: validates the identity/credential against a simple array. The default is
- Authenticator interface to implement your own, e.g. database
Output
Included:
- ProblemDetailOutput: the json response output will be generated using the mezzio/problem-details package, which needs to be required in your composer.json
- ExceptionOutput: it will just throw the exception, and you can handle it in other middleware
- Output interface to implement your own, e.g. HTML, XML
All versions of api-auth with dependencies
PHP Build Version
Package Version
Requires
php Version
^8.0
mezzio/mezzio-problem-details Version ^1.2
psr/container Version ^1.0 || ^2.0
psr/http-message Version ^1.0 || ^2.0
psr/http-server-middleware Version ^1.0 || ^2.0
mezzio/mezzio-problem-details Version ^1.2
psr/container Version ^1.0 || ^2.0
psr/http-message Version ^1.0 || ^2.0
psr/http-server-middleware Version ^1.0 || ^2.0
The package los/api-auth contains the following files
Loading the files please wait ....