gbrousse/php-token-manager 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

Total Downloads Latest Stable Version

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
  • 点击次数: 5
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: LGPL-3.0
  • 更新时间: 2015-10-30