Giter Site home page Giter Site logo

fakerino's Introduction

Fakerino

Fakerino is a fake data generator framework fully extensible.

Latest Stable Version Latest Unstable Version Travis Ci

SensioLabsInsight Code Climate Quality Score Code Coverage

License

Join the chat at https://gitter.im/Fakerino/Fakerino

###Main features

  • Fake complex data (e.g. person: name, surname, hobby, country, ... ).
  • Fake single data (e.g. name, surname, integer, text, ...).
  • Fake data in different languages.
  • Fake regular expression data (e.g. url => '/www\.\w+\.com/').
  • Fake data multiple times.
  • Fake a database table row/s with one line of code.
  • Fake a Twig string or file automatically (e.g. Hello Mr {{ surname }})
  • Fake a PHP object/entity in one line of code (fills public properties and setters with fake data).
  • Support JSON, array and string output.
  • Support array, Yaml, XML, PHP, Txt and Ini configurations.
  • Fake from command line interface.

For more information about installation, features, support, contribution, or other, please read the Fakerino docs.

Installation

Use Composer to manage the dependencies of your project. ####In your project folder run:

composer require fakerino/fakerino='~0.8'
vendor/fakerino/fakerino/build/ods vendor/fakerino/fakerino/data

Like a stand-alone project run:

composer create-project fakerino/fakerino fakerino

Quick start

<?php
require ('vendor/autoload.php'); 
use Fakerino\Fakerino;

$fakerino = Fakerino::create();
echo $fakerino->fake('Surname')->toJson(); //["Donovan"]
echo $fakerino->fake('nameFemale'); //Alice
echo $fakerino->fake('/www\.\w+\.com/'); //www.nikdjap.com
echo $fakerino->fake('nameMale')->num(3); //Bob Jack Rick
echo $fakerino->fake(array('nameMale', 'Surname'))->num(3)->toJson(); //[["Simon","Rodgers"],["Dean","Smith"],["Anthony","Bauman"]]

With a configuration you can combine fake data, or declare your customs.

$fakerino = Fakerino::create('./conf.php');
print_r($fakerino->fake('fakeChat')->toArray());
/* 
Array(
    [0] => Array
        (
            [0] => Array
                (
                    [0] => Fake Rino <[email protected]>
                    [1] => 01 Jan 2015 14:14:42
                    [2] => Hi gentle developer!
                )
            [1] => Array
                (
                    [0] => Anonym Dev <[email protected]>
                    [1] => 01 Jan 2015 14:17:42
                    [2] => Hi Fakerino!
                )
        )
)*/

With Command line

app/fake -h //for help
app/fake namemale surname //Travis Baldwin
app/fake surname -j //["Brooks"]
app/fake nameMale -n 2 //Nick Andy
app/fake country -c path/config.ini //uses a config file
app/fake surname -l de-DE //Schleßinger
app/fake -s 'Hello Mrs {{namefemale}} {{surname}}' -l de-DE //Hello Mrs Seeliger Ceylin
app/fake -t tableName -c path/confix.xml -n 10 //Inserts 10 fake rows into tableName

Third parties

fakerino's People

Contributors

natebrunette avatar niklongstone avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fakerino's Issues

Fake table - date field error

When a table with similar structure as below will be filed with fake data.
An error occurs for the date value:

PHP Fatal error:  Call to a member function format() on string in /var/www/html/fake/vendor/doctrine/dbal/lib/Doctrine/DBAL/Types/DateType.php on line 53

Fatal error: Call to a member function format() on string in /var/www/html/fake/vendor/doctrine/dbal/lib/Doctrine/DBAL/Types/DateType.php on line 53

Table example to reproduce the error:

+---------------------+--------------+------+-----+---------+----------------+
| Field               | Type         | Null | Key | Default | Extra          |
+---------------------+--------------+------+-----+---------+----------------+
| id                  | int(11)      | NO   | PRI | NULL    | auto_increment |
| title               | varchar(255) | YES  |     | NULL    |                |
| description         | varchar(255) | YES  |     | NULL    |                |
| scheduled           | date         | YES  |     | NULL    |                |

Could be related to this doctrine/dbal#869
but anyway needs a check from Fakerino side.

README's problem

Fake 500,000 data in 1 minute. is simply not possible in a lib description. On what hardware? On what software? What data?

Numbers like this are good to:

  1. Compare two or more libs (if results were given for multiple libs, which is not the case).
  2. Attract ignorant weird special people.

Sadly, I am not sure that's the way to go to have an attractive lib. (I am an example, I haven't looked at the code but I already have a negative view of the lib.)

Installing ODS data in a better way

The current installation is contained in the build/ods file and dependend from unzip, a better way should be found maybe using composer post-* script.

Faking mysql doesn't work

Using the following call on CLI: app/fake -t tx_downloadcounter_domain_model_download -n 100 -c configs/git.typo3.org.php throws the following error:


Call Stack:
    0.3657     237568   1. {main}() /Volumes/Work/Projects/apps/fakerino/app/fake:0
    0.3697     616424   2. Fakerino\Core\Console\FakeConsole->run() /Volumes/Work/Projects/apps/fakerino/app/fake:30
    0.3769     907552   3. Fakerino\Core\FakeDataFactory->fakeTable(???) /Volumes/Work/Projects/apps/fakerino/src/Fakerino/Core/Console/FakeConsole.php:92
  212.1116    3122104   4. Fakerino\Core\Filler\DbFiller->fill() /Volumes/Work/Projects/apps/fakerino/src/Fakerino/Core/FakeDataFactory.php:122
  257.4617    3265192   5. Fakerino\Core\Database\DoctrineLayer->insert(???) /Volumes/Work/Projects/apps/fakerino/src/Fakerino/Core/Filler/DbFiller.php:78
  257.4639    3459432   6. Doctrine\DBAL\Connection->executeQuery(???, ???, ???, ???) /Volumes/Work/Projects/apps/fakerino/src/Fakerino/Core/Database/DoctrineLayer.php:125
  257.4654    3514504   7. Doctrine\DBAL\Connection->_bindTypedValues(???, ???, ???) /Volumes/Work/Projects/apps/fakerino/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:846
  257.4657    3518448   8. Doctrine\DBAL\Connection->getBindingInfo(???, ???) /Volumes/Work/Projects/apps/fakerino/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:1488
  257.4657    3518512   9. Doctrine\DBAL\Types\DateTimeType->convertToDatabaseValue(???, ???) /Volumes/Work/Projects/apps/fakerino/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:1523

I've traced it down to the point, that Doctrine doesn't provide the length information and therefore data is truncated to 0.

I'm using PHP 5.6.29 (cli) and mysql 5.7.10.

Installation of fakerino was done through composer create-project fakerino/fakerino fakerino

The configuration file looks like:

<?php

$conf['database'] = array(
    'dbname' => 'typo3_git_62',
    'user' => 'root',
    'password' => '',
    'host' => 'localhost',
    'driver' => 'pdo_mysql',
);

PDOException when fake a table

When you want to inject fake data into a table and the database connection is wrong, would be better to handle with a try/catch the PDOException and return the error message.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.