ProductPromotion
Logo

PHP

made by https://0x3d.site

GitHub - FakerPHP/Faker: Faker is a PHP library that generates fake data for you
Faker is a PHP library that generates fake data for you - FakerPHP/Faker
Visit Site

GitHub - FakerPHP/Faker: Faker is a PHP library that generates fake data for you

GitHub - FakerPHP/Faker: Faker is a PHP library that generates fake data for you

Faker

Packagist Downloads GitHub Workflow Status Type Coverage Code Coverage

Faker is a PHP library that generates fake data for you. Whether you need to bootstrap your database, create good-looking XML documents, fill-in your persistence to stress test it, or anonymize data taken from a production service, Faker is for you.

It's heavily inspired by Perl's Data::Faker, and by Ruby's Faker.

Getting Started

Installation

Faker requires PHP >= 7.4.

composer require fakerphp/faker

Documentation

Full documentation can be found over on fakerphp.github.io.

Basic Usage

Use Faker\Factory::create() to create and initialize a Faker generator, which can generate data by accessing methods named after the type of data you want.

<?php

declare(strict_types=1);

require_once 'vendor/autoload.php';

// use the factory to create a Faker\Generator instance
$faker = Faker\Factory::create();
// generate data by calling methods
echo $faker->name();
// 'Vince Sporer'
echo $faker->email();
// '[email protected]'
echo $faker->text();
// 'Numquam ut mollitia at consequuntur inventore dolorem.'

Each call to $faker->name() yields a different (random) result. This is because Faker uses __call() magic, and forwards Faker\Generator->$method() calls to Faker\Generator->format($method, $attributes).

<?php

declare(strict_types=1);

for ($i = 0; $i < 3; $i++) {
    echo $faker->name() . "\n";
}

// 'Cyrus Boyle'
// 'Alena Cummerata'
// 'Orlo Bergstrom'

Automated refactoring

If you already used this library with its properties, they are now deprecated and needs to be replaced by their equivalent methods.

You can use the provided Rector config file to automate the work.

Run

composer require --dev rector/rector

to install rector/rector.

Run

vendor/bin/rector process src/ --config vendor/fakerphp/faker/rector-migrate.php

to run rector/rector.

Note: do not forget to replace src/ with the path to your source directory.

Alternatively, import the configuration in your rector.php file:

<?php

declare(strict_types=1);

use Rector\Config;

return static function (Config\RectorConfig $rectorConfig): void {
    $rectorConfig->import('vendor/fakerphp/faker/rector-migrate.php');
};

License

Faker is released under the MIT License. See LICENSE for details.

PHP Version Support Policy

The maintainers of this package add support for a PHP version following its initial release and drop support for a PHP version one year after it has reached its end of security support.

Backward compatibility promise

Faker is using Semver. This means that versions are tagged with MAJOR.MINOR.PATCH. Only a new major version will be allowed to break backward compatibility (BC).

Classes marked as @experimental or @internal are not included in our backward compatibility promise. You are also not guaranteed that the value returned from a method is always the same. You are guaranteed that the data type will not change.

PHP 8 introduced named arguments, which increased the cost and reduces flexibility for package maintainers. The names of the arguments for methods in Faker is not included in our BC promise.

More Resources
to explore the angular.

mail [email protected] to add your project or resources here 🔥.

Related Articles
to learn about angular.

FAQ's
to learn more about Angular JS.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory