germania-kg / authentication
1.2.0
2023-01-09 14:13 UTC
Requires
- php: ^7.4|^8.0
- aura/session: ^2.1
- psr/http-message: ^1.0
- psr/http-server-middleware: ^1.0
- psr/log: ^1.0
Requires (Dev)
- monolog/monolog: ^1.16
- php-coveralls/php-coveralls: ^2.0
- phpstan/phpstan: ^1.9
- phpunit/phpunit: ^8.0|^9.0
This package is auto-updated.
Last update: 2024-09-09 17:48:09 UTC
README
安装
$ composer require germania-kg/authentication
概览
AuthUserInterface
namespace Germania\Authentication; // Setter and Getter for User ID. public function getId(); public function setId( $id );
AuthUserMiddleware
构造函数接受
- AuthUserInterface 实例
- Aura\Session\SegmentInterface 实例。
- 用户 ID 会话字段名称
- 可选:PSR-3 Logger
中间件执行
- 将用户存储在具有
user
属性的 Psr\Http\Message\ServerRequestInterface 请求对象中。它将在$next
中间件中可用。 - 在运行
$next
中间件后,如果user
属性仍然是 AuthUserInterface 实例,则使用 SegmentInterface 实例存储用户 ID。
LoginController
待定。
LogoutController
待定。
开发
$ git clone git@github.com:GermaniaKG/Authentication.git germania-authentication
$ cd germania-authentication
$ composer install
单元测试
可以复制 phpunit.xml.dist
到 phpunit.xml
并根据需要修改,或者保持不变。像这样运行 PhpUnit
$ vendor/bin/phpunit