gbrousse/php-token-manager
最新稳定版本:v1.0.1-rc
Composer 安装命令:
composer require gbrousse/php-token-manager
包简介
PHP library used to secure web ressources (files, images, streams, ...) with simple token system.
README 文档
README
Secure your web ressources (files, images, streams, ...) with simple token system.
Installation
Install the latest version with
$ composer require gbrousse/php-token-manager
Basic usage
get a token
<?php use TokenManager\TokenManager; // Setup $options = array( 'dir' => 'directory/where/stock/tokens', 'prefix' => 'prefix_of_tokens_files', 'salt' => 'salt', 'hash' => 'md5', // hash use to generate token 'maxTimeout' => 7200, //max lifetime for a token 'maxTimeout' => 600, //min lifetime for a token ); $TokenMgr = new TokenManager($options); // Get token $token = $TokenMgr->get();
If you use a single configuration for the tokens, modify the attributes of the class instead of using options array.
Verify a token
<?php use TokenManager\TokenManager; // Setup $options = array( 'dir' => 'directory/where/stock/tokens', 'prefix' => 'prefix_of_tokens_files', 'salt' => 'salt', 'hash' => 'md5', // hash use to generate token 'maxTimeout' => 7200, //max lifetime for a token 'maxTimeout' => 600, //min lifetime for a token ); $TokenMgr = new TokenManager($options); // Verify token validity if($TokenMgr->isValid($token)){ // action to do if token is OK }
If you use a single configuration for the tokens, modify the attributes of the class instead of using options array.
Examples
About
Requirements
- php-token-manager works with PHP 5.3 or above.
Submitting bugs and feature requests
Bugs and feature request are tracked on GitHub
Author
Gregory Brousse - pro@gregory-brousse.fr - http://gregory-brousse.fr
License
php-token-manager is licensed under the LGPL-3.0 License - see the LICENSE file for details
统计信息
- 总下载量: 13
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: LGPL-3.0
- 更新时间: 2015-10-30