2017 © Pedro Peláez
 

yii2-extension yii2-db-faker

Fill your database table with fake data

image

miksir/yii2-db-faker

Fill your database table with fake data

  • Tuesday, May 3, 2016
  • by MiksIr
  • Repository
  • 1 Watchers
  • 2 Stars
  • 118 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 33 % Grown

The README.md

This Yii2 command can fill your database with fake data. Useful if you need lot of fake data, 1 mil rows and more., (*1)

You can switch between different data generators (or write your own) and different database connectors., (*2)

Props: - you can write own sources of fake data (proxy to fzaninotto/Faker included) - different connectors to datbase for save data. ActiveRecord - slow but with model logic, YiiDAO - fast batch insert, TODO: postgresql COPY connector., (*3)

Generators included: - FakeGenerator: this is proxy to Faker and use same logic, paths and templates as yii2-faker . Read yii2-faker documentation about creating fixtures template file, (*4)

Database connectors (called here as dbproviders): - Csv: simple csv writer - ActiveRecord: create model, fill with data and call ->save() - YiiDAO: insert data using sql (via Yii's PDO), can insert multiple rows per one insert, (*5)

Installation

Use composer :), (*6)

composer require miksir/yii2-db-faker

You should configure your application as follows (usually in console.php; and you can use any alias, not only "faker"):, (*7)

'controllerMap' => [
 'faker' => [
     'class' => 'MiksIr\Yii2DbFaker\FakerController',
 ],
],

Call help for current generator and dbprovider, (*8)

yii faker/help

Examples

yii faker/generate --count=1000000 --dbprovider=YiiDAO generator_template=users dbprovider_table=users dbprovider_truncate=1

Truncate table users and create about 1 million rows using template from \@tests/unit/templates/fixtures/users.php, (*9)

The Versions

03/05 2016

dev-master

9999999-dev

Fill your database table with fake data

  Sources   Download

MIT

The Requires

 

by Dmitry MiksIr

02/05 2016

1.0.1

1.0.1.0

Fill your database table with fake data

  Sources   Download

MIT

The Requires

 

by Dmitry MiksIr