zachleigh / fake-better
Faker provider to use more realistic fake data, extensive Laravel support.
Installs: 19
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 3
Type:project
Requires
- fzaninotto/faker: ^1.4
Requires (Dev)
- laravel/laravel: ~5.6
- phpunit/phpunit: ^7.0
This package is auto-updated.
Last update: 2024-11-26 06:15:31 UTC
README
Because Lorem Ipsum sucks sometimes.
Contents
About
This package lets you define real copy to use in Faker instead Lorem Ipsum. You only need to add the included Copy Faker provider to Faker.
Install
This pacakge requires Faker.
Install via composer:
composer require zachleigh/fake-better
If using Laravel, see the Laravel Support section.
Once installed, you need to add the FakeBetter\Providers\Copy
provider to your
Faker instance:
use Faker\Generator; use FakeBetter\Providers\Copy; $faker = new Generator(); $copyProvider = new Copy($faker); $copyProvider->setCopyPath('path/to/copy/directory'); $faker->addProvider($copyProvider);
Usage
In the set copy path, define any file structure you like. All files must be php files
and should return an array. To access your custom copy, use the copy
method and
pass it a dot separated path to your copy:
$faker->copy('path.to.copy');
If the defined copy is an array, a random value will be returned.
Laravel Support
If using Laravel, register the service provider:
FakeBetter\Laravel\ServiceProvider::class
Override the default paths by importing the config:
php artisan vendor:publish --provider="FakeBetter\Laravel\ServiceProvider" --tag="config"
Create new copy files:
php artisan make:faker-copy my/original/copy/file
In addition to the Copy provider, this package also allows you to easily create custom Faker providers:
php artisan make:faker-provider CustomProvider
Contributing
Contributions are more than welcome. Fork, improve and make a pull request.
For bugs, ideas for improvement or other, please create an issue.