{"id":33018361,"url":"https://github.com/mauris/samsui","last_synced_at":"2025-11-16T14:00:34.341Z","repository":{"id":62525380,"uuid":"11385088","full_name":"mauris/samsui","owner":"mauris","description":"Samsui is a factory library for building PHP objects useful for setting up test data in your applications.","archived":true,"fork":false,"pushed_at":"2014-08-19T16:28:46.000Z","size":728,"stargazers_count":31,"open_issues_count":0,"forks_count":3,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-07-31T05:33:59.017Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mauris.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-07-13T08:06:34.000Z","updated_at":"2025-01-29T19:31:51.000Z","dependencies_parsed_at":"2022-11-02T12:15:48.158Z","dependency_job_id":null,"html_url":"https://github.com/mauris/samsui","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/mauris/samsui","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mauris%2Fsamsui","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mauris%2Fsamsui/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mauris%2Fsamsui/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mauris%2Fsamsui/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mauris","download_url":"https://codeload.github.com/mauris/samsui/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mauris%2Fsamsui/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":284719042,"owners_count":27052182,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-16T02:00:05.974Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-11-13T18:00:39.567Z","updated_at":"2025-11-16T14:00:34.335Z","avatar_url":"https://github.com/mauris.png","language":"PHP","funding_links":[],"categories":["测试","测试 Testing","Testing","测试( Testing )"],"sub_categories":[],"readme":"#Samsui\n\n[![Build Status](http://img.shields.io/travis/mauris/samsui.svg)](https://travis-ci.org/mauris/samsui) [![Latest Stable Version](http://img.shields.io/packagist/v/mauris/samsui.svg)](https://packagist.org/packages/mauris/samsui) [![Total Downloads](http://img.shields.io/packagist/dm/mauris/samsui.svg)](https://packagist.org/packages/mauris/samsui) [![](http://img.shields.io/badge/license-BSD%203--Clause-brightgreen.svg)](license.md) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/mauris/samsui/badges/quality-score.png?s=6b2205353be4190d48d7ba39dbf8f072d78e76ce)](https://scrutinizer-ci.com/g/mauris/samsui/) [![Code Coverage](https://scrutinizer-ci.com/g/mauris/samsui/badges/coverage.png?s=464892ae6edf1ce667b7d11ae0fb3216bc33470d)](https://scrutinizer-ci.com/g/mauris/samsui/)\n\nSamsui 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.\n\n\u003e [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.\n\nWith Samsui, you can quickly build prototype application and generate as many data as you need for testing your prototype.\n\n- Samsui was created by and maintained by [Sam Yong](https://github.com/mauris).\n- Samsui uses [Travis CI](https://travis-ci.org/mauris/samsui) to check that the code works.\n- Samsui uses [Scrutinizer CI] to check code quality and test coverage.\n- Samsui uses [Composer](https://getcomposer.org/) to load and manage its dependencies.\n- Samsui is licensed under the [BSD 3-Clause](license.md) license.\n\n##Installation\n\nSamsui is a PHP library that manages its dependencies using [Composer](http://getcomposer.org). You can directly use [Samsui](https://packagist.org/packages/mauris/samsui/) in your application through Composer:\n\n    {\n        \"require\": {\n          \"mauris/samsui\": \"1.0.*\"\n        }\n    }\n\nThen just run Composer:\n\n    $ php composer.phar install\n\n##Usage\n\nYou can provide definition of your objects to Samsui:\n\n\tuse Samsui\\Factory;\n\n\t$factory = new Factory();\n\n\t// define an object quickly\n\t$factory-\u003edefine('person')\n\t\t-\u003esequence('personId')\n\t\t-\u003eattr('firstName', 'James')\n        -\u003eattr('lastName', 'Clark')\n        -\u003eattr('email', function ($i, $o) {\n            return strtolower($o-\u003efirstName . '.' . $o-\u003elastName . '@example.com');\n        })\n\t\t-\u003eattr('createdTime', function () {\n\t\t\treturn time();\n\t\t});\n\nYou can build one at a time, or hundreds of them on the go!\n\n\t// build them on the go!\n\t$person = $factory-\u003ebuild('person');\n\n\t// or build many!~\n\t$people = $factory-\u003ebuild('person', 500);\n\nThe output of a person object would be (well, after JSON encoding):\n\n    {\n        \"personId\": \"1\",\n        \"firstName\": \"James\",\n        \"lastName\": \"Clark\",\n        \"email\": \"james.clark@example.com\",\n        \"createdTime\": \"1383465074\"\n    }\n\nYou can also use Samsui's fake data generator to fill your objects with real variety and randomity:\n\n    use Samsui\\Factory;\n    use Samsui\\Generator\\Generator;\n\n    $factory = new Factory();\n\n    // define an object quickly\n    $factory-\u003edefine('person')\n        -\u003esequence('personId')\n        -\u003eattr('firstName', Generator::person()-\u003efirstName)\n        -\u003eattr('lastName', Generator::person()-\u003elastName)\n        -\u003eattr('email', function ($i, $o) {\n            return Generator::email()-\u003eemailAddress(\n                array(\n                    'firstName' =\u003e $o-\u003efirstName,\n                    'lastName' =\u003e $o-\u003elastName,\n                    'domains' =\u003e array(\n                        'hotmail.com',\n                        'gmail.com',\n                        'example.com'\n                    )\n                )\n            );\n        })\n        -\u003eattr('createdTime', function () {\n            return time();\n        });\n\n##Upcoming\n\n- Generation of data based on locale (location+language)\n- Implementation of Data Generators for use with attributes\n  - [ ] Names (different locale)\n  - [x] Email addresses\n  - [ ] Addresses and Postal Codes\n  - [x] Age (based on age groups defined)\n  - [x] Gender (with Natural Birth Ratio)\n  - [x] IP Address v4 and v6\n  - [x] URLs\n  - [x] Lorem Ipsum text\n  - [x] Date/Times (based on range or sequence)\n  - [x] Hash functions output (SHA-1, SHA-256 etc.)\n  - [x] GPS latitude / longitude, land coordiates\n  - [ ] Handphone numbers\n  - [x] Colors (RGB array, Hexadecimal)\n  - [ ] Images (Avatar, Sized)\n- Improved JSON reader\n- Generation of Factory definitions to PHP classes directly\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmauris%2Fsamsui","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmauris%2Fsamsui","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmauris%2Fsamsui/lists"}