2017 © Pedro Peláez
 

library random

image

germania-kg/random

  • Friday, February 2, 2018
  • by germania-kg
  • Repository
  • 2 Watchers
  • 0 Stars
  • 12 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Germania KG · Random

Pimple Service Provider for creating a Random Generator from ircmaxells' RandomLib, (*1)

Packagist PHP version Build Status Scrutinizer Code Quality Code Coverage Build Status, (*2)

Installation

$ composer require germania-kg/random

Setup

<?php
use Germania\Random\RandomServiceProvider;

// A. Use with Slim or Pimple
$app = new \Slim\App;
$dic = $app->getContainer();
$dic = new Pimple\Container;

// B. Register Service Provider.
// Optionally pass length and strenth:
$rsp = new RandomServiceProvider;
$rsp = new RandomServiceProvider( 240, 5);

$dic->register( $rsp  );

Services

RandomGenerator

Returns a RandomLib\Generator instance. See RandomLib docs on how to deal with it., (*3)

$generator = $dic['RandomGenerator'];
$str = $generator->generateString(32, 'abcdef');

RandomGenerator.Callable

Returns a Callable wrapper around the RandomLib\Generator instance which creates a random string af arbitrary length. The callable accepts an optional string length., (*4)

$random_callable = $dic['RandomGenerator.Callable'];
$str = $random_callable(); // 256 characters
$str = $random_callable( 256 ); // 256 chars
$str = $random_callable( 64 ); // 64 chars.

RandomGenerator.Strength

Returns the \SecurityLib\Strength instance used for creating the RandomLib\Generator, (*5)

$strength = $dic['RandomGenerator.Strength'];

RandomGenerator.Length

Returns the default length of generated random strings., (*6)

$length = $dic['RandomGenerator.Length'];

Development

$ git clone https://github.com/GermaniaKG/Random.git
$ cd Random
$ composer install

Unit tests

Either copy phpunit.xml.dist to phpunit.xml and adapt to your needs, or leave as is. Run PhpUnit test or composer scripts like this:, (*7)

$ composer test
# or
$ vendor/bin/phpunit

The Versions

02/02 2018

dev-develop

dev-develop

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Carsten Witt

02/02 2018

dev-master

9999999-dev

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Carsten Witt

02/02 2018

1.0.3

1.0.3.0

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Carsten Witt

02/02 2018

1.0.0

1.0.0.0

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Carsten Witt

02/02 2018

1.0.1

1.0.1.0

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Carsten Witt