icomefromthenet / faker
Test data generator using Doctrine DBAL and Symfony2 components
Requires
- php: ^7.1
- ext-dom: *
- ext-pcre: *
- ext-spl: *
- doctrine/common: ^2.8
- doctrine/dbal: ^2.8
- icomefromthenet/reverse-regex: ^0.1.0.0
- monolog/monolog: ^1.2
- pimple/pimple: 1.0.*
- symfony/class-loader: ^2.8
- symfony/config: ^2.8
- symfony/console: ^2.8
- symfony/event-dispatcher: ^2.8
- symfony/filesystem: ^2.8
- symfony/finder: ^2.8
- symfony/http-kernel: ^2.8
- symfony/yaml: ^2.8
- twig/twig: ^2.0
- zendframework/zend-progressbar: ^2.5.2
- zendframework/zend-text: ^2.6
Requires (Dev)
- phpunit/dbunit: >=1.2
- phpunit/phpunit: 7
This package is not auto-updated.
Last update: 2024-11-09 13:14:07 UTC
README
#Faker - A Database testing tool.
There have been a few ports of the original Perl Faker and a few to php. What started as another has grown instead into a comprehensive data generation tool, powered by Doctrine DBAL and Symfony2 Components.
Where I think Faker will help you:
- Write PHPUnit DBUnit fixtures, this will save you time (especially if that involves more than one platform).
- You need to fill database with test data for various loading test.
If your a database tester or a lone developer Faker will help you test your database quicker.
##Features
- Supports multiple platforms using Doctrine DBAL. (MySql|PGSQL|Oracle|Sqlite|MSSql).
- Supports PHPUnit Dataset XML for DBUnit fixtures.
- Supports Standard Sql DDL (insert statements) for the platforms mentioned above.
- Output Formats have their own templates that can be customized per project. (add own branding).
- Configured via XML file that feels closer to your database.
- Many built in datatypes, Including text, numeric , autoincrements, email , city names etc
- Embraces extension, write own types, writters and locales.
- Installed via composer.
- Analyse and build struct from existing database.
- Seed your random number generator for repeatable results (seed global|table|column|type).
- Supported custom locals, generate test data in unicode. (Not just ENGLISH).
- Project folder that can be version controled with your project.
##Requirements.
SQlite3, PHP5.3.3, MBString, Pear and Linux / Mac (windows support in beta).
All components are included by default in package installs of php.
How to install
The easist way to install to use composer
{ "require-dev" : { "icomefromthenet/faker": "dev-master" } }
Read more from the starting guide
Quick Example - still wondering
Turn your SCHEMA
<?xml version="1.0"?> <schema name="sakila" randomGenerator="simple" generatorSeed="1000"> <writer platform="mysql" format="sql" singleFileMode="true" /> <table name="actor" generate="100" randomGenerator="simple" generatorSeed="1000"> <column name="actor_id" type="integer" randomGenerator="simple" generatorSeed="1000"> <datatype name="autoincrement"> <option name="start" value="1" /> <option name="randomGenerator" value="simple" /> <option name="generatorSeed" value="100" /> </datatype> </column> <column name="first_name" type="string"> <datatype name="people"> <option name="format" value="{fname}" /> </datatype> </column> <column name="last_name" type="string"> <datatype name="people"> <option name="format" value="{lname}" /> </datatype> </column> <column name="last_update" type="datetime"> <datatype name="date"> <option name="start" value="today" /> <option name="modify" value="+1 week" /> <option name="max" value="today +10 weeks" /> </datatype> </column> </table> <table name="actor_homes" generate="10000"> <column name="actor_id" type="integer"> <foreign-key name="actor_homes.actor_id" foreignTable="actor" foreignColumn="actor_id" /> </column> </table> </schema>
Calling command
../vendor/bin/faker.php faker:generate schema.xml
INTO DATA
-- Migrations Faker Dump -- version 1.0.2 -- https://github.com/icomefromthenet/Faker -- -- Host: localhost -- Generation Time: 2012-07-03T06:08:02+00:00 -- PHP Version: 5.3.10-1ubuntu3.2 -- Platform: mysql SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; -- -- Database: sakila -- -- -------------------------------------------------------- -- -- Table: actor -- USE sakila; INSERT INTO `actor` (`actor_id`,`first_name`,`last_name`,`last_update`) VALUES (1,'Jordan','Proctor','2012-07-03 00:00:00'); INSERT INTO `actor` (`actor_id`,`first_name`,`last_name`,`last_update`) VALUES (2,'Michele','Welsh','2012-07-10 00:00:00'); INSERT INTO `actor` (`actor_id`,`first_name`,`last_name`,`last_update`) VALUES (3,'Paul','Lam','2012-07-17 00:00:00'); INSERT INTO `actor` (`actor_id`,`first_name`,`last_name`,`last_update`) VALUES (4,'Sheila','Best','2012-07-24 00:00:00'); INSERT INTO `actor` (`actor_id`,`first_name`,`last_name`,`last_update`) VALUES (5,'Karl','Moser','2012-07-31 00:00:00'); INSERT INTO `actor` (`actor_id`,`first_name`,`last_name`,`last_update`) VALUES (6,'Victoria','Todd','2012-08-07 00:00:00'); INSERT INTO `actor` (`actor_id`,`first_name`,`last_name`,`last_update`) VALUES (7,'Julia','Sun','2012-08-14 00:00:00'); INSERT INTO `actor` (`actor_id`,`first_name`,`last_name`,`last_update`) VALUES (8,'Jimmy','Rankin','2012-08-21 00:00:00'); INSERT INTO `actor` (`actor_id`,`first_name`,`last_name`,`last_update`) VALUES (9,'George','Brantley','2012-08-28 00:00:00'); INSERT INTO `actor` (`actor_id`,`first_name`,`last_name`,`last_update`) VALUES (10,'Wendy','Walton','2012-09-04 00:00:00'); INSERT INTO `actor` (`actor_id`,`first_name`,`last_name`,`last_update`) VALUES (11,'Lester','Osborne','2012-09-11 00:00:00'); INSERT INTO `actor` (`actor_id`,`first_name`,`last_name`,`last_update`) VALUES (12,'Edwin','Upchurch','2012-07-03 00:00:00'); INSERT INTO `actor` (`actor_id`,`first_name`,`last_name`,`last_update`) VALUES (13,'Courtney','Ennis','2012-07-10 00:00:00'); INSERT INTO `actor` (`actor_id`,`first_name`,`last_name`,`last_update`) VALUES (14,'Nina','Fischer','2012-07-17 00:00:00'); INSERT INTO `actor` (`actor_id`,`first_name`,`last_name`,`last_update`) VALUES (15,'Brooke','Benson','2012-07-24 00:00:00'); INSERT INTO `actor` (`actor_id`,`first_name`,`last_name`,`last_update`) VALUES (16,'Angela','Rodriguez','2012-07-31 00:00:00'); INSERT INTO `actor` (`actor_id`,`first_name`,`last_name`,`last_update`) VALUES (17,'Todd','Wiggins','2012-08-07 00:00:00'); INSERT INTO `actor` (`actor_id`,`first_name`,`last_name`,`last_update`) VALUES (18,'Ron','Smith','2012-08-14 00:00:00'); INSERT INTO `actor` (`actor_id`,`first_name`,`last_name`,`last_update`) VALUES (19,'Andrew','Coates','2012-08-21 00:00:00'); INSERT INTO `actor` (`actor_id`,`first_name`,`last_name`,`last_update`) VALUES (20,'Kerry','Harrison','2012-08-28 00:00:00'); INSERT INTO `actor` (`actor_id`,`first_name`,`last_name`,`last_update`) VALUES (21,'Harvey','Mercer','2012-09-04 00:00:00'); INSERT INTO `actor` (`actor_id`,`first_name`,`last_name`,`last_update`) VALUES (22,'Herbert','Gould','2012-09-11 00:00:00'); INSERT INTO `actor` (`actor_id`,`first_name`,`last_name`,`last_update`) VALUES (23,'Donna','Forrest','2012-07-03 00:00:00'); INSERT INTO `actor` (`actor_id`,`first_name`,`last_name`,`last_update`) VALUES (24,'Vivian','Sumner','2012-07-10 00:00:00'); INSERT INTO `actor` (`actor_id`,`first_name`,`last_name`,`last_update`) VALUES (25,'Carol','Oliver','2012-07-17 00:00:00'); INSERT INTO `actor` (`actor_id`,`first_name`,`last_name`,`last_update`) VALUES (26,'Patricia','Tate','2012-07-24 00:00:00'); INSERT INTO `actor` (`actor_id`,`first_name`,`last_name`,`last_update`) VALUES (27,'Dolores','Bowers','2012-07-31 00:00:00'); INSERT INTO `actor` (`actor_id`,`first_name`,`last_name`,`last_update`) VALUES (28,'Gerald','Pearson','2012-08-07 00:00:00');