clickalicious/rng
Composer 安装命令:
composer require clickalicious/rng
包简介
The secure Pseudo Random Number Generator (PRNG) for PHP.
README 文档
README
The secure Pseudo Random Number Generator PRNG for PHP.
Table of Contents
Features
- Provides a secure
PRNG: pseudo random number generator (64-Bit support) - OOP facade to PHP core functionality
- High performance (developed using a profiler)
- Lightweight and high-quality codebase (following PSR standards e.g.
PSR-1,2,4) - Stable, clean + well documented code
- Unit-tested with a good coverage
Examples
Generate random number between 1 and 10 using OPEN_SSL random bytes (library default):
$generator = new \Clickalicious\Rng\Generator(); $number = $generator->generate(1, 10); echo $number;
Generate random number between 1 and 10 using PHP_MERSENNE_TWISTER random bytes:
$generator = new \Clickalicious\Rng\Generator(\Clickalicious\Rng\Generator::MODE_PHP_MERSENNE_TWISTER); $number = $generator->generate(1, 10); echo $number;
Generate 16 random bytes using MODE_OPEN_SSL random bytes (library default):
$generator = new \Clickalicious\Rng\Generator(); $bytes = $generator->getRandomBytes(16);
Generate 32 random bytes using NATIVE-PHP random bytes:
$generator = new \Clickalicious\Rng\Generator(); $bytes = $generator->getRandomBytes(32);
Visualization
You can create a visualization of randomization (as you can see below but larger size) through visual.php » (the file is located in root). As you may see: The first square (light grey) is the default PHP random generated noise which is aligned by a pattern (you will see in the large version of the picture). The following three squares a generated using a more secure generator like Open-SSL for example.
Requirements
PHP >= 5.6(compatible up to version7.2as well asHHVM)
Philosophy
This library provides a state of the art PRNG (Pseudo Random Number Generator) implementation to generate secure Pseudo Random Numbers with PHP. The generation is either based on Open SSL or MCrypt or as fallback on PHP's internal functionality. The library also provides a very good Seed generator on puplic API. If you are interested in the difference between real and pseduo randomness then you could start at https://www.random.org/randomness/.
DILBERT © 2001 Scott Adams.
Versioning
For a consistent versioning i decided to make use of Semantic Versioning 2.0.0 http://semver.org. Its easy to understand, very common and known from many other software projects.
Roadmap
- No open issues.
Security Issues
If you encounter a (potential) security issue don't hesitate to get in contact with us opensource@clickalicious.de before releasing it to the public. So i get a chance to prepare and release an update before the issue is getting shared. Thank you!
Participate & Share
... yeah. If you're a code monkey too - maybe we can build a force ;) If you would like to participate in either Code, Comments, Documentation, Wiki, Bug-Reports, Unit-Tests, Bug-Fixes, Feedback and/or Critic then please let me know as well!
Sponsors
Thanks to our sponsors and supporters:
| JetBrains | Navicat |
|---|---|
Copyright
Icons made by Freepik from www.flaticon.com is licensed by CC 3.0 BYclickalicious/rng 适用场景与选型建议
clickalicious/rng 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.92k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2015 年 03 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「generator」 「number」 「random」 「openssl」 「PRNG」 「RNG」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 clickalicious/rng 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 clickalicious/rng 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 clickalicious/rng 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Memio's PrettyPrinter, used to generate PHP code from given Model
A package for working with arbitrary precision numbers in Laravel.
Faker Japanese is a Faker provider that generates fake Japanese related data for you.
Gambling Algorithms for Certification.
Validates Turkish National Identification Number
Reusable utilities library for Lacus Solutions' packages (type description, HTML escaping, random sequences)
统计信息
- 总下载量: 2.92k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 28
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-03-21

