utopia-php/auth
Composer 安装命令:
composer require utopia-php/auth
包简介
A simple PHP authentication library
README 文档
README
Important
This repository is a read-only mirror of the utopia-php monorepo. Development happens in packages/auth — please open issues and pull requests there.
Utopia Auth is a simple, dependency-free PHP library for building authentication and authorization: secure password hashing, authentication proofs (tokens, codes, phrases), and signing/verifying OAuth2 and OpenID Connect JWTs. It is maintained by the Appwrite team.
Although it is part of the Utopia Framework project, it is dependency free and can be used standalone with any PHP project or framework.
Getting started
Install using Composer:
composer require utopia-php/auth
<?php use Utopia\Auth\Proofs\Password; $password = new Password(); $hash = $password->hash('user-password'); $isValid = $password->verify('user-password', $hash);
System requirements
Utopia Auth requires PHP 8.3 or later. We recommend using the latest PHP version whenever possible.
Features
- Password hashing — Argon2, Bcrypt, Scrypt (and a modified Scrypt), SHA, PHPass, and MD5 (legacy only)
- Authentication proofs — cryptographically random tokens, one-time codes (e.g. 2FA), and human-readable phrases
- Data store — a base64-encodable key/value envelope for serializing authentication state
- Token issuers — mint signed JWS: OAuth2 access tokens (RFC 9068), refresh tokens, and OpenID Connect ID tokens
- Token verifiers — verify RS256/HS256 JWS with an
alg-confusion guard and standard claim checks - OAuth2 helpers — RFC 8707 resource indicators, OpenID Connect prompts, RFC 9126 pushed authorization request URIs, and OAuth Client ID Metadata Documents
Documentation
- Password Hashing — algorithms and tuning
- Authentication Proofs — tokens, one-time codes, and phrases
- Data Store — encode/decode authentication state
- JSON Web Tokens — JWS mechanics, verification, and claim/header names
- OAuth2 and OpenID Connect — token examples and protocol helpers
Tests
To run all unit tests, use the following Docker command:
docker compose exec tests vendor/bin/phpunit --configuration phpunit.xml tests
Security
We take security seriously. If you discover any security-related issues, please email security@appwrite.io instead of using the issue tracker.
Contributing
All code contributions - including those of people having commit access - must go through a pull request and be approved by a core developer before being merged. This is to ensure a proper review of all the code.
We truly ❤️ pull requests! If you wish to help, you can learn more about how you can contribute to this project in the contribution guide.
Copyright and license
The MIT License (MIT) http://www.opensource.org/licenses/mit-license.php
utopia-php/auth 适用场景与选型建议
utopia-php/auth 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 127.14k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2025 年 03 月 08 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「security」 「Authentication」 「auth」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 utopia-php/auth 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 utopia-php/auth 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 utopia-php/auth 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Automatically logs-in users if they are already authenticated by a remote source. (e.g. environment variable REMOTE_USER)
GraphQL authentication for your headless Craft CMS applications.
Provide a way to secure accesses to all routes of an symfony application.
Laravel middleware to restrict a site or specific routes using HTTP basic authentication
It's a barebone security class written on PHP
Email Toolkit Plugin for CakePHP
统计信息
- 总下载量: 127.14k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 14
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-03-08