1. Go to this page and download the library: Download avto-dev/faker-providers library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
avto-dev / faker-providers example snippets
use Faker\Generator as FakerGenerator;
use AvtoDev\FakerProviders\ExtendedFaker;
/** @var FakerGenerator|ExtendedFaker $faker */
$faker = new FakerGenerator;
$provider = \AvtoDev\FakerProviders\Providers\Cars\MarkAndModelProvider::class;
$faker->addProvider(new $provider($faker));
echo $faker->carMarkAndModel; // BMW X3
// File: ./database/factories/CarFactory.php
use App\Models\Car;
use Faker\Generator as Faker;
use Illuminate\Database\Eloquent\Factory as EloquentFactory;
/** @var EloquentFactory $factory */
$factory->define(Car::class, function (Faker $faker) {
/** @var Faker|\AvtoDev\FakerProviders\ExtendedFaker $faker */
return [
'vin' => $faker->vinCode,
'mark' => $mark = $faker->carMark,
'model' => $faker->carModel($mark),
];
});
/** @var \Faker\Generator|\AvtoDev\FakerProviders\ExtendedFaker $faker */
$faker->carMarkAndModel; // Skoda Octavia
$faker->carMark; // Daewoo
$faker->carModel; // Juke
$faker->carModel('Honda'); // Civic Type R
$faker->carGeneration; // IV Restyling
/** @var \Faker\Generator|\AvtoDev\FakerProviders\ExtendedFaker $faker */
$faker->userAvatarUri('Bill Gates', 200, 200); // Link to the some user avatar
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.