{"id":22678280,"url":"https://github.com/hyperf-ext/auth","last_synced_at":"2025-04-12T14:41:42.161Z","repository":{"id":48289838,"uuid":"293322557","full_name":"hyperf-ext/auth","owner":"hyperf-ext","description":"The Hyperf Auth package.","archived":false,"fork":false,"pushed_at":"2023-04-20T09:35:40.000Z","size":87,"stargazers_count":20,"open_issues_count":8,"forks_count":16,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-10T02:17:40.867Z","etag":null,"topics":["auth","hyperf","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hyperf-ext.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-09-06T16:59:53.000Z","updated_at":"2024-12-16T05:50:25.000Z","dependencies_parsed_at":"2024-06-18T20:05:16.687Z","dependency_job_id":"d68406f6-b3f2-43cc-bca2-ba7f99904a37","html_url":"https://github.com/hyperf-ext/auth","commit_stats":{"total_commits":7,"total_committers":2,"mean_commits":3.5,"dds":0.2857142857142857,"last_synced_commit":"bf88f313a45d8a5ee73951261cd7c4a4088e761f"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperf-ext%2Fauth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperf-ext%2Fauth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperf-ext%2Fauth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperf-ext%2Fauth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hyperf-ext","download_url":"https://codeload.github.com/hyperf-ext/auth/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248582850,"owners_count":21128461,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["auth","hyperf","php"],"created_at":"2024-12-09T18:14:38.167Z","updated_at":"2025-04-12T14:41:42.126Z","avatar_url":"https://github.com/hyperf-ext.png","language":"PHP","readme":"# Hyperf 认证组件\n\n该组件移植了 Laravel Auth 组件（[illuminate/auth](https://github.com/illuminate/auth )）相对完整的功能特性，除了中间件传参和邮件通知。\n\n* Hyperf 的中间件遵循 PSR-15 的规范，无法使用 Laravel 的方式通过路由向中间件传递值，故在实现上与 Laravel 不同，仅实现了一个基础的身份认证中间件抽象类 `HyperfExt\\Auth\\Middlewares\\AbstractAuthenticateMiddleware`。\n* 邮件（[illuminate/mail](https://github.com/illuminate/mail )）和通知（[illuminate/notifications](https://github.com/illuminate/notifications )）尚未移植完成。\n\n该组件实现了两个自定义注解。\n* Hyperf\\Di\\Annotations\\AbstractAnnotation\\Auth  \n可用于类和方法，语法 `Auth({\"GUARD_CONF_NAME\"[, ...]}[, passable=bool])`：\n  * 第一个参数为 Guard 名列表\n  * 第二个 `passable` 可选参数默认值为 `false`，设置为 `true` 时未认证的用户也可以通过 Guard，不会抛出为认证的异常，在某些特殊情况下将会比较有用。例如，同一个 API 需要对认证用户和非认证用户展示不同的数据。\n\n* Hyperf\\Di\\Annotations\\AbstractAnnotation\\Policy  \n可用于类，语法 `Policy({\"MODEL_FQCN\"\\[, ...\\]})`：  \n  * 参数为模型 FQCN 列表\n\n另外，Gate 和策略的注册方法与 Laravel 不同。\n\nGate 可以通过注入 `HyperfExt\\Auth\\Contracts\\Access\\GateManagerInterface` 来调用实例的 `define` 方法注册。或者监听 `HyperfExt\\Auth\\Events\\GateManagerResolved` 事件来在监听器中访问事件的 `gate` 属性（GateManagerInterface）来注册。\n\n策略可以通过 `gen:policy` 命令来创建，例如 `gen:policy PostPolicy --model=App\\\\Model\\\\Post`。也可以在配置文件的 `policies` 中定义模型类和策略类的映射。\n\n如需使用 JWT，请额外安装 [`hyperf-ext/jwt`](https://github.com/hyperf-ext/jwt) 组件。\n\n## 安装\n\n```shell script\ncomposer require hyperf-ext/auth\n```\n\n## 发布配置\n\n```shell script\nphp bin/hyperf.php vendor:publish hyperf-ext/auth\n```\n\n\u003e 文件位于 `config/autoload/auth.php`。\n\n## 配置\n\n\u003e 详细说明见配置文件。\n\n## 使用\n\n### 身份认证\n\n文档待完成。\n\n### 授权\n\n文档待完成。","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyperf-ext%2Fauth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhyperf-ext%2Fauth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyperf-ext%2Fauth/lists"}