#Samsui
[![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/)
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.
- Samsui was created by and maintained by [Sam Yong](https://github.com/mauris).
- Samsui uses [Travis CI](https://travis-ci.org/mauris/samsui) to check that the code works.
- Samsui uses [Scrutinizer CI] to check code quality and test coverage.
- Samsui uses [Composer](https://getcomposer.org/) to load and manage its dependencies.
- Samsui is licensed under the [BSD 3-Clause](license.md) license.
##Installation
Samsui 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:
{
"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 (well, after JSON encoding):
{
"personId": "1",
"firstName": "James",
"lastName": "Clark",
"email": "james.clark@example.com",
"createdTime": "1383465074"
}
You can also use Samsui's fake data generator to fill your objects with real variety and randomity:
use Samsui\Factory;
use Samsui\Generator\Generator;
$factory = new Factory();
// define an object quickly
$factory->define('person')
->sequence('personId')
->attr('firstName', Generator::person()->firstName)
->attr('lastName', Generator::person()->lastName)
->attr('email', function ($i, $o) {
return Generator::email()->emailAddress(
array(
'firstName' => $o->firstName,
'lastName' => $o->lastName,
'domains' => array(
'hotmail.com',
'gmail.com',
'example.com'
)
)
);
})
->attr('createdTime', function () {
return time();
});
##Upcoming
- Generation of data based on locale (location+language)
- Implementation of Data Generators for use with attributes
- [ ] Names (different locale)
- [x] Email addresses
- [ ] Addresses and Postal Codes
- [x] Age (based on age groups defined)
- [x] Gender (with Natural Birth Ratio)
- [x] IP Address v4 and v6
- [x] URLs
- [x] Lorem Ipsum text
- [x] Date/Times (based on range or sequence)
- [x] Hash functions output (SHA-1, SHA-256 etc.)
- [x] GPS latitude / longitude, land coordiates
- [ ] Handphone numbers
- [x] Colors (RGB array, Hexadecimal)
- [ ] Images (Avatar, Sized)
- Improved JSON reader
- Generation of Factory definitions to PHP classes directly
没有合适的资源?快使用搜索试试~ 我知道了~
samsui-master 伪数据生成库
共67个文件
php:50个
json:9个
md:2个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 64 浏览量
2023-07-01
15:05:32
上传
评论
收藏 43KB ZIP 举报
温馨提示
伪数据生成器按照一定的数据规则,生成大量的数据,支持teradata数据导入和oracle数据导入。 软件作用:为测试软件在大数据量下的性能而给数据库导入大量的数据。
资源推荐
资源详情
资源评论
收起资源包目录
samsui-master伪数据生成库.zip (67个子文件)
新建文本文档 (2).txt 0B
samsui-master
license.md 1KB
.travis.yml 370B
src
Samsui
Factory.php 2KB
Provider
IpAddress.php 929B
Gender.php 406B
Date.php 1KB
Address.php 1KB
String.php 834B
Locale.php 514B
GPS.php 1016B
ProviderInterface.php 208B
Url.php 1KB
Telephone.php 759B
Lipsum.php 2KB
Email.php 585B
Age.php 873B
Math.php 2KB
BaseProvider.php 279B
Color.php 844B
Hash.php 372B
DefinitionInterface.php 1KB
Generator
GeneratorInterface.php 68B
Generator.php 792B
FactoryInterface.php 861B
Definition.php 3KB
Resource
Fetcher.php 1KB
Loader.php 2KB
FetcherInterface.php 99B
Wrapper.php 1KB
ObjectCollection.php 700B
data
urls.json 5KB
email.json 3KB
lipsum.json 6KB
en_SG
telephone.json 350B
address.json 4KB
mobile.json 514B
male-names.json 6KB
gps.json 13KB
composer.json 520B
readme.md 5KB
composer.lock 4KB
test
phpunit.xml.dist 522B
Samsui
FactoryTest.php 2KB
WrapperTest.php 1KB
Provider
AgeTest.php 1KB
GPSTest.php 2KB
HashTest.php 909B
GenderTest.php 1KB
TelephoneTest.php 1KB
LipsumTest.php 2KB
ColorTest.php 2KB
StringTest.php 1KB
EmailTest.php 720B
AddressTest.php 2KB
MathTest.php 4KB
UrlTest.php 1KB
LocaleTest.php 839B
DateTest.php 2KB
IpAddressTest.php 2KB
Generator
GeneratorTest.php 858B
DefinitionTest.php 2KB
MockDefinition.php 346B
ObjectCollectionTest.php 374B
bootstrap.php 98B
phpcs.xml 161B
.gitignore 41B
共 67 条
- 1
资源评论
lmr廖
- 粉丝: 288
- 资源: 158
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功