unisys12/fake-canine
Composer 安装命令:
composer require unisys12/fake-canine
包简介
Extend FakerPHP to add support for adding fake Canines to a project
关键字:
README 文档
README
Extends FakerPHP to add support for adding fake Canines to a project
Installation
You can install the package via composer:
composer require unisys12/fake-canine
Usage
<?php namespace Vendor\YourProject; use Unisys12\FakeCanine\FakeCanineProvider; use Faker\Generator; class CanineModelFactory { $fakeCanine = new FakeCanineProvider((new Generator)); return [ 'name' => $fakeCanine->name(), 'breed' => $fakeCanine->breed(), 'gender' => $fakeCanine->gender ] }
In a Laravel project, you would simply pass the faker property to the FakeCanineProvider like so,
namespace Database\Factories; use App\Models\Canine; use Unisys12\FakeCanine\FakeCanineProvider; class CanineFactory extends Factory { protected $model = Canine::class; public function definition() { $fakeCanine = new FakeCanineProvider($this->faker); return [ 'name' => $fakeCanine->name(), 'breed' => $fakeCanine->breed(), 'gender' => $fakeCanine->gender ] } }
Gender
gender is a property of Unisys12\FakeCanine\FakeCanineProvider and is set to null at initialization of the class. To generate a random name, a gender must be selected first. Once this is done, by calling the name() method, the gender selected is stored in a public property that is assessable to the class.
The above behavior might change in the future.
Testing
composer test
On Windows, you should add a -w tag (without a space) to the script cmds located in the composer.json.
composer test-w
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email unisys12@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 7
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-08-18