Download the PHP package hnraytek/flame-auth without Composer

On this page you can find all versions of the php package hnraytek/flame-auth. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package flame-auth

Flame Auth Module

基于 Flame Module Kernel 的身份认证模块,提供 Token 管理和路由鉴权功能。

✨ 特性

📋 安装

📚 配置说明

🚀 快速开始

1. 基础用法

2. 使用 AuthApiController

tips:继承该类从而统一 $tokenType 的设置(如 frontend 、 backend)

3. Token 管理

📝 API 说明

AuthApiController 方法

方法 说明
getUserId() 获取当前登录用户 ID
setUserId($userId, $keepTime, $keep) 设置用户 ID 并生成新 token,$keepTime 默认 1200 秒,$keep 为 true 时同时生成 refresh token
getToken() 获取当前 token
getRefreshToken() 获取刷新 token
setRefreshToken($keepTime) 生成刷新 token,返回 refresh token 字符串
clearToken($userId) 清除指定用户的 token(默认清除当前用户)
checkAuth() 检查用户是否登录,未登录返回 401
checkToken() 验证当前 token 是否有效
isLoggedIn() 判断用户是否已登录

Token 服务方法

方法 说明
generateToken() 生成随机 token(静态方法)
getRequestToken() 从请求头获取 token
set($token, $type, $userId, $expire) 存储 token
get($token) 获取 token 数据
check($token, $type, $userId) 验证 token
delete($token) 删除指定 token
clear($userId, $type) 清理用户所有 token
tokenExpirationCheck($token) 检查 token 是否过期

📝 鉴权策略

Allow 模式(推荐)

Block 模式

tips: 为了保持兼容性,推荐在所有路由增加 #[NoAuth] 和 #[NeedAuth]

📝 异常处理

模块会抛出 TokenExpirationException 异常(HTTP 401),建议在全局异常处理器中统一处理:

📝 注意事项

⚠️ 安全提示:

💡 最佳实践:

📝 许可证

Apache-2.0 License

👤 作者

🤝 贡献

欢迎提交 Issue 和 Pull Request!


All versions of flame-auth with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
hnraytek/flame-module-kernel Version ^1.0.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package hnraytek/flame-auth contains the following files

Loading the files please wait ...