<commit_before>#Samsui

Samsui is a factory library for building PHP objects useful for setting up test data in your applications. It is mainly inspired by [Rosie](https://github.com/bkeepers/rosie) for JavaScript and [factory_girl](https://github.com/thoughtbot/factory_girl) for Ruby.

> [Samsui women](https://en.wikipedia.org/wiki/Samsui_women) refers to a group of Chinese immigrants who came to Singapore to work in construction and industries. Their hardwork contributed to Singapore's development as a colony and young nation.

With Samsui, you can quickly build prototype application and generate as many data as you need for testing your prototype.

##Installation

Samsui is a PHP library that manages its dependencies using [Composer](http://getcomposer.org). You can directly use Samsui in your application through Composer as well:

    {
        "require": {
			"mauris/samsui": "1.0.*"
        }
    }

Then just run composer:

    $ php composer.phar install

##Usage

You can provide definition of your objects to Samsui:

	use Samsui\Factory;

	$factory = new Factory();

	// define an object quickly
	$factory->define('person')
		->sequence('personId')
		->attr('firstName', 'James')
        ->attr('lastName', 'Clark')
        ->attr('email', function ($i, $o) {
            return strtolower($o->firstName . '.' . $o->lastName . '@example.com');
        })
		->attr('createdTime', function () {
			return time();
		});

You can build one at a time, or hundreds of them on the go!

	// build them on the go!
	$person = $factory->build('person');

	// or build many!~
	$people = $factory->build('person', 500);

The output of a person object would be:

    {
        personId: 1,
        firstName: 'James',
        lastName: 'Clark',
        email: '<EMAIL>',
        createdTime: 1383465074
    }

##Upcoming

- Implementation of Data Generators for use with attributes
  - Names (different locale)
  - Email addresses
  - Addresses (from different countries) and Postal Codes
  - Age (based on age groups defined)
  - Gender
  - Lorem Ipsum text
  - DateTimes (based on range or sequence)
  - Serial numbers (barcode standards)
  - Hash functions output (SHA-1, SHA-256 etc.)
  - GPS latitude / longitude
  - Handphone numbers (based on country formats)
- Generation of Factory definitions to PHP classes directly<commit_msg>updated readme list of upcoming<commit_after>#Samsui

Samsui is a factory library for building PHP objects useful for setting up test data in your applications. It is mainly inspired by [Rosie](https://github.com/bkeepers/rosie) for JavaScript and [factory_girl](https://github.com/thoughtbot/factory_girl) for Ruby.

> [Samsui women](https://en.wikipedia.org/wiki/Samsui_women) refers to a group of Chinese immigrants who came to Singapore to work in construction and industries. Their hardwork contributed to Singapore's development as a colony and young nation.

With Samsui, you can quickly build prototype application and generate as many data as you need for testing your prototype.

##Installation

Samsui is a PHP library that manages its dependencies using [Composer](http://getcomposer.org). You can directly use Samsui in your application through Composer as well:

    {
        "require": {
			"mauris/samsui": "1.0.*"
        }
    }

Then just run composer:

    $ php composer.phar install

##Usage

You can provide definition of your objects to Samsui:

	use Samsui\Factory;

	$factory = new Factory();

	// define an object quickly
	$factory->define('person')
		->sequence('personId')
		->attr('firstName', 'James')
        ->attr('lastName', 'Clark')
        ->attr('email', function ($i, $o) {
            return strtolower($o->firstName . '.' . $o->lastName . '@example.com');
        })
		->attr('createdTime', function () {
			return time();
		});

You can build one at a time, or hundreds of them on the go!

	// build them on the go!
	$person = $factory->build('person');

	// or build many!~
	$people = $factory->build('person', 500);

The output of a person object would be:

    {
        personId: 1,
        firstName: 'James',
        lastName: 'Clark',
        email: '<EMAIL>',
        createdTime: 1383465074
    }

##Upcoming

- Implementation of Data Generators for use with attributes
  - Names (different locale)
  - Email addresses
  - Addresses (from different countries) and Postal Codes
  - Age (based on age groups defined)
  - Gender
  - Lorem Ipsum text
  - DateTimes (based on range or sequence)
  - Serial numbers (barcode standards)
  - Hash functions output (SHA-1, SHA-256 etc.)
  - GPS latitude / longitude
  - Handphone numbers (based on country formats)
  - Random amount of money
- Generation of Factory definitions to PHP classes directly
{'fraction_non_alphanumeric': 0.10514117151285293, 'fraction_numerical': 0.008428150021070375, 'mean_word_length': 3.307622504537205, 'pattern_counts': {'":': 4, '<': 5, '<?xml version=': 0, '>': 27, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '698061', 'n_tokens_mistral': 1420, 'n_tokens_neox': 1322, 'n_words': 531}