Random Extension Polyfill for PHP
Go to file
Anton Smirnov f85c6145dc Test Secure 2022-07-23 08:24:38 +03:00
debug Do not duplicate generated value 2022-07-23 05:29:00 +03:00
docs Fix lists 2022-07-23 06:22:09 +03:00
src Point to the upstream sources 2022-07-23 06:00:50 +03:00
tests Test Secure 2022-07-23 08:24:38 +03:00
.gitattributes do not export doc configs 2022-07-23 07:33:09 +03:00
.gitignore Test Secure 2022-07-23 08:24:38 +03:00
CHANGELOG.md Changelog for 0.1.0 2022-07-23 06:26:18 +03:00
COPYING.adoc Legalese 2022-07-23 05:11:35 +03:00
LICENSE.md Legalese 2022-07-23 05:11:35 +03:00
README.md Expand metadata 2022-07-23 06:52:35 +03:00
composer.json Test Secure 2022-07-23 08:24:38 +03:00
phpcs.xml Suppress crashing sniff 2022-07-23 05:15:30 +03:00
phpunit.xml.dist Test Secure 2022-07-23 08:24:38 +03:00
psalm.xml Psalm config and fixes 2022-07-23 00:14:55 +03:00

README.md

Random Extension Polyfill for PHP

This is a polyfill for the new ext-random extension that will be released with PHP 8.2.

RFC:

Requirements

  • PHP 7.1
  • GMP extension

Installation

composer require 'arokettu/random-polyfill'

Compatibility

The library is compatible with ext-random as released in PHP 8.2.0 beta 1.

What works

  • Random\Randomizer
    • getInt($min, $max)
    • getInt()
  • Engines
    • Random\Engine interface
    • Random\CryptoSafeEngine interface
    • Secure Engine: Random\Engine\Secure
    • Mersenne Twister: Random\Engine\Mt19937

TODO

  • Tests & CI
  • Random\Randomizer
    • getBytes($length)
    • shuffleArray($array)
    • shuffleBytes($bytes)
    • pickArrayKeys($array, $num)
  • Keep updating with fixes from the upcoming betas and release 1.0.0 around PHP 8.2.0 rc 1
  • Empty arokettu/random-polyfill v1.99 for PHP 8.2.0 users
  • Other engines
    • Maybe
    • Some day
    • If I have time
    • Don't count on it

Documentation

Read full documentation here: https://sandfox.dev/php/random-polyfill.html

Also on Read the Docs: https://php-random-polyfill.readthedocs.io/

Support

Please file issues on our main repo at GitLab: https://gitlab.com/sandfox/php-random-polyfill/-/issues

License

The library is available as open source under the terms of the 3-Clause BSD License. See COPYING.adoc for additional licenses.