dtool数据库工具
dtool 是一款数据库工具。具有以下功能:
-
模拟数据生成器
-
生成 MySQL 数据库字典
-
数据库和表自动生产数据
-
Postman.js 接口调试时生成随机数据,方便测试
安装
使用 Composer 安装:
composer require "yeosz/dtool"
使用
Provider
$provider = new \Yeosz\Dtool\Provider(); $data = [ 'string' => $provider->getString(10), 'mb_string' => $provider->getMbString(10), 'city' => $provider->city, 'address' => $provider->address, 'uuid' => $provider->uuid, 'id_card' => $provider->id_card, 'image_url' => $provider->image_url, 'bitmap_url' => $provider->bitmap_url, 'name' => $provider->name, 'first_name' => $provider->first_name, 'last_name' => $provider->last_name, 'phone' => $provider->phone, 'mobile' => $provider->mobile, 'email' => $provider->email, 'qq' => $provider->qq, 'postcode' => $provider->postcode, 'company_name' => $provider->company_name, 'ean8' => $provider->ean8, 'ean13' => $provider->ean13, 'timestamp' => $provider->timestamp, 'year' => $provider->year, 'date' => $provider->date, 'time' => $provider->time, 'integer' => $provider->integer, 'random' => $provider->randomValue([1, 2, 3]), 'payment' => $provider->payment, 'bank' => $provider->bank, ]; print_r($data); // 自增长 $provider->addIncrement('sort', 1); var_dump($provider->sort); var_dump($provider->sort); var_dump($provider->sort); // 自定义供应器 $provider->addProvider('my_time', function(){ return time(); }); var_dump($provider->my_time);
评论