nigelgreenway/signa 问题修复 & 功能扩展

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

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

nigelgreenway/signa

Composer 安装命令:

composer require nigelgreenway/signa

包简介

A framework agnostic token generator

README 文档

README

Latest Version on Packagist Software License Build Status Total Downloads

A framework agnostic token generator built for PHP 7. Uses scalar type hinting and return type hinting.

Will generate a secure token using hash_hmac with access to the value and the expiry date of that token for use within your storage. An insecure token can also be generated with access to just a value, useful for a CSRF token.

Install

Via Composer

$ composer require nigelgreenway/signa

Usage

<?php

require __DIR__.'/vendor/autoload.php';

$tokenGenerator = new \Signa\TokenGenerator('s0m3-s3cur3-k3y');

$tokenWithExpiry = $tokenGenerator->tokenWithExpiry(
    [
        'user_name' => 'Scooby Doo',
        'age'       => 7,
    ],
    new \DateTimeImmutable('+30 Days'),
    'sha256'
);

// A secure token, for password resets and such
echo "A secure token\n";
echo sprintf("Value: %s\n", $tokenWithExpiry->value()); // Some hash string
echo sprintf("Expires on: %s\n", $tokenWithExpiry->expiresOn()->format('Y-m-d H:i:s')); // 30 days from today, aka the future

// An insecure token, generally CSRF and such
echo "\nAn insecure token\n";
$insecureToken = $tokenGenerator->token(36);
echo sprintf("Value: %s (Length %d)\n", $insecureToken->value(), strlen($insecureToken->value())); // Some string, 36 char length

echo "\nAn insecure token with odd value\n";
$insecureToken = $tokenGenerator->token(33);
echo sprintf("Value: %s (Length: %d)\n", $insecureToken->value(), strlen($insecureToken->value())); // Some string, 33 char length

Change log

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Security

If you discover any security related issues, please email github@futurepixels.co.uk instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 3.05k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 6
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-04-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固