Download the PHP package renshan/randbuilder without Composer
On this page you can find all versions of the php package renshan/randbuilder. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Please rate this library. Is it a good library?
Informations about the package randbuilder
RandBuilder
A random data generator
Schema
Ok, $scheme is a scheme used to generate the data you want, it's an array php, this array contains two items: object and count, object is the real schema, and count indicate how many you want.
Let's see the object, however of whatever, object is an array, items in object are fields to be generated, the most important thing is to define a field, items has a few attributes:
- type
typeis required, now RandBuilder support three types: string, integer and float. - length
typeis required iftypeis string - prefix
prefixdefaults to '' - end
enddefaults to '' - unique
uniqueindicate the field is unique or not, defaults tofalse - range
rangeis not required for integer and float, it indicate the min and the max number to be generated - precision
rangeforfloat, it default to 0
Note: if unique is true, the actual quantity produced may be less than the specified quantity.
Example
use RandBuilder\Builder;
$schema = array(
"object" => array(
"name" => array(
"type" => "string",
"length" => 10,
"prefix" => "builder_",
"end" => "_redliub",
"unique" => true
),
"hash" => array(
"type" => "string",
"length" => array(10,20),
"reducer" => "md5"
),
"number" => array(
"type" => "integer",
"range" => array(10, 100),
"unique" => true
),
"price" => array(
"type" => "float",
"range" => array(100, 1000),
"precision" => 2
)
),
"count" => 10 // How many object will be make
);
$objects = Builder::build($schema);
``All versions of randbuilder with dependencies
PHP Build Version
Package Version
Requires
php Version
>=7.0.0
The package renshan/randbuilder contains the following files
Loading the files please wait ...