2017 © Pedro Peláez
 

cakephp-plugin cakephp-fake-seeder

A shell to seed your database with fake and/or fixed data.

image

ravage84/cakephp-fake-seeder

A shell to seed your database with fake and/or fixed data.

  • Monday, January 22, 2018
  • by ravage84
  • Repository
  • 2 Watchers
  • 7 Stars
  • 3,465 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 3 Open issues
  • 2 Versions
  • 8 % Grown

The README.md

CakePHP Fake Seeder

Travis-CI Build Status Coverage Status Scrutinizer Code Quality Total Downloads Latest Stable Version, (*1)

A CakePHP shell to seed your database with fake and/or fixed data., (*2)

Uses Faker to generate the fake data. Uses shell tasks for implementing specific seeders. Organizes logical groups of seeders in custom seeder shells/suites., (*3)

Why should I use it?

You are wondering why you should use this plugin instead of using Faker directly or creating fake data on your own?, (*4)

This plugin..., (*5)

  • keeps you from doing the repetitive work (DRY)
  • provides you three working modes (manual faking to fully automatic guessing)
  • helps you to stick to conventions, by following CakePHP's "Convention over Configuration" principle
  • still provides you flexible configuration
  • reduces documentation needs
  • is properly covered by unit tests
  • is easy to learn
  • is extensible

Installation

Requirements

  • PHP >= 5.4
  • CakePHP 2.x (tested with 2.6.2, 2.7.3)

Installation via composer

composer require ravage84/cakephp-fake-seeder

Installation alternatives

Refer to the CakePHP CookBook section How To Install Plugins., (*6)

CakePHP Version Support

This plugin only supports CakePHP 2.x., (*7)

Versioning

The releases of this plugin are versioned using SemVer., (*8)

Configuration

Set the configuration key FakeSeeder.seedable to true, by adding Configure::write('FakeSeeder.seedable', true); to your boostrap code., (*9)

How to use

After installing and configuring the plugin, you can invoke the shell by executing php Console/cake.php FakeSeeder.seeder -h., (*10)

Welcome to CakePHP v2.6.2 Console
---------------------------------------------------------------
App : app
Path: D:\dev\xampp\htdocs\cate\app\
---------------------------------------------------------------
A shell to seed your database with fake and/or fixed data.

Uses Faker to generate the fake data.
Uses shell tasks for implementing specific seeders.
Organizes logical groups of seeders in custom seeder shells/suites.

Usage:
cake fake_seeder.seeder [options] [<model>]

Options:

--help, -h         Display this help.
--verbose, -v      Enable verbose output.
--quiet, -q        Enable quiet output.
--mode, -m         The seeding mode.
                   'manual' = No Field formatters are guessed.
                   'auto' = All field formatters are guessed.
                   'mixed' = Only missing field formatters are guessed.
                   (choices: manual|auto|mixed)
--locale, -l       The locale to use for Faker.
--records, -r      The amount of records to seed.
--validate         Whether or not to validate when saving the seeding
                   data. (choices: first|1|)
--seed, -s         Set the seed number for Faker to use.
--no-truncate      Prevents that the model gets truncated before
                   seeding.

Arguments:

model  The name of a seeder shell task without 'SeederTask' suffix.
       For example 'Article' for 'ArticleSeederTask'.
       Alternatively the name of a model.
       It will try to guess the field formatters then.
       (optional)

All shell options can be set through:
1. CLI parameter, e.g. "--records"
2. The seeder specific configuration, e.g. "FakeSeeder.Article.records"
3. The general seeder configuration, e.g "FakeSeeder.records"
4. The seeder shell task class properties, e.g. "$_records"
The values are checked in that order. The first value found is taken.
If no value is set, it will fall back to an optional default value.

When no seeders are set (e.g. in a custom seeder suite) and if called
without arguments, it will prompt to execute one of the seeder shell
tasks available.

Contributing

See CONTRIBUTING.md, (*11)

Changelog

See CHANGELOG.md, (*12)

TODOs

  • Improve Documentation
  • Simplify integration of 3rd party data provider
  • Implement seeder shell task baking
  • Check possibility to use code for TestFixtures, like gourmet/faker

License

This plugin is licensed under the MIT License., (*13)

Attribution

This project was inspired by the works of others, such as:, (*14)

The Versions

22/01 2018

dev-master

9999999-dev https://github.com/ravage84/cakephp-fake-seeder

A shell to seed your database with fake and/or fixed data.

  Sources   Download

MIT

The Requires

 

The Development Requires

plugin cakephp fixtures faker data seeder

31/08 2015

0.1.0

0.1.0.0 https://github.com/ravage84/cakephp-fake-seeder

A shell to seed your database with fake and/or fixed data.

  Sources   Download

MIT

The Requires

 

The Development Requires

plugin cakephp fixtures faker data seeder