cupidontech/multi-faker
最新稳定版本:1.0.0
Composer 安装命令:
composer require cupidontech/multi-faker
包简介
Package for generating Faker by country
README 文档
README
Package for generating Faker by country
Version : 1.0.0 (in version 1.0.0 , currently being tested and developed)
Table of Contents
Installation
Install the Package by the following command,
composer require cupidontech/multi-faker
If you encounter an error during package installation, just type this command:
composer require cupidontech/multi-faker --ignore-platform-reqs
Add Provider
Add the provider to your config/app into provider section if using lower version of laravel,
Cupidontech\MultiFaker\MultiFakerServiceProvider::class,
Add the country configuration to your .env file
MULTI_FAKER_DEFAULT_COUNTRY= {Country}
e.g = MULTI_FAKER_DEFAULT_COUNTRY=Cameroon
e.g = MULTI_FAKER_DEFAULT_COUNTRY=Nigeria
e.g = MULTI_FAKER_DEFAULT_COUNTRY=France
e.g = MULTI_FAKER_DEFAULT_COUNTRY=Canada
e.g = MULTI_FAKER_DEFAULT_COUNTRY=UnitedStates
e.g = MULTI_FAKER_DEFAULT_COUNTRY=Germany
e.g = MULTI_FAKER_DEFAULT_COUNTRY=IvoryCoast
e.g = MULTI_FAKER_DEFAULT_COUNTRY=Senegal
e.g = MULTI_FAKER_DEFAULT_COUNTRY=SouthAfrica
Basic Usage
To use this package, follow these steps:
use Cupidontech\MultiFaker\MultiFakerGenerator;
$faker = new MultiFakerGenerator();
$name = $faker->firstName();
$address = $faker->address();
$email = $faker->email();
use in a controller
<? php
namespace App\Http\Controllers;
use Cupidontech\MultiFaker\MultiFakerGenerator;
class Test extends Controller
{
public function generateData(MultiFakerGenerator $faker)
{
// Example of use
$name = $faker->last_name();
$address = $faker->address();
// ...
return view('data', compact('name', 'address'));
}
}
Make sure you add the necessary classes and import the package correctly into your Laravel application.
Formatters
Local names
$firstName = $faker->first_name();
$lastName = $faker->last_name();
username
$username = $faker->username();
Gender
$gender = $faker->gender();
Local addresses
$address = $faker->address();
Local phone numbers
$phoneNumber = $faker->phone();
$email = $faker->email();
date
$date = $faker->date();
Generation of city and region names
$region = $faker->region();
$city = $faker->cities();
$city = $faker->city($region);
Location
$region = $faker->region();
coordinates
$coordinates = $faker->coordinates();
password
$password = $faker->password();
text
$text = $faker->text(30);
companyName
$companyName = $faker->companyName();
creditCardNumber
$creditCardNumber = $faker->creditCardNumber();
product
$product = $faker->product();
food
$food = $faker->food();
Countries supported
Cameroon , Nigeria , France , Canada , United State , Germany , IvoryCoast , Senegal , SouthAfrica
(coming soon) ... Ivory Coast ,United States , Brazil , United Kingdom , Germany , Spain , South Africa , Ghana , Ethiopia , Kenya , Morocco , Algeria , India , China , Australia
Contributions
We welcome contributions from the community. If you would like to contribute to this project, please follow these steps:
- Fork the project.
- Create a branch for your feature (
git checkout -b new-feature). - Make your changes and commit them (
git commit -am 'Add new feature'). - Push the branch (
git push origin new-feature). - Create a pull request on GitHub.
License
This package is distributed under the [MIT] license. See LICENSE.md for details.
统计信息
- 总下载量: 53
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-09-14