定制 miksir/yii2-db-faker 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

miksir/yii2-db-faker

Composer 安装命令:

composer require miksir/yii2-db-faker

包简介

Fill your database table with fake data

README 文档

README

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

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

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.

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

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

Installation

Use composer :)

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"):

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

Call help for current generator and dbprovider

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

统计信息

  • 总下载量: 879
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-05-01

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固