unisys12 / fake-canine
Extend FakerPHP to add support for adding fake Canines to a project
Requires
- php: ^7.4 || ^8.0
- fakerphp/faker: ^1.13
Requires (Dev)
- phpstan/phpstan: ^0.12.64
- phpunit/phpunit: ^9.0
This package is auto-updated.
Last update: 2025-05-20 02:26:19 UTC
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.