2017 © Pedro Peláez
 

library faker-provider-collection

A collection of custom providers for the Faker library

image

mbezhanov/faker-provider-collection

A collection of custom providers for the Faker library

  • Thursday, May 17, 2018
  • by mbezhanov
  • Repository
  • 3 Watchers
  • 12 Stars
  • 5,521 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 6 Versions
  • 80 % Grown

The README.md

faker-provider-collection

CircleCI Codecov Packagist, (*1)

A growing collection of useful Providers for fakerphp/faker mostly ported to PHP from the stympy/faker Ruby library., (*2)

Contents

  1. Installation
  2. Basic Usage
  3. Available Formatters
  4. Integrations
  5. Contributing

Installation

composer require mbezhanov/faker-provider-collection

Basic Usage

You can use the ProviderCollectionHelper utility class to quickly add all providers to the Faker generator:, (*3)

<?php

$faker = \Faker\Factory::create();
\Bezhanov\Faker\ProviderCollectionHelper::addAllProvidersTo($faker);

Formatters

Below is the list of bundled formatters in the default locale., (*4)

Bezhanov\Faker\Provider\Avatar

Generates an avatar URL using the RoboHash web service., (*5)

<?php

$faker = \Faker\Factory::create();
$faker->addProvider(new \Bezhanov\Faker\Provider\Avatar($faker));

$faker->avatar; // https://robohash.org/repellat-veritatis-consequatur.png?size=300x300&set=set1
$faker->avatar('foo'); // https://robohash.org/foo.png?size=300x300&set=set1
$faker->avatar('foo', '300x300'); // https://robohash.org/foo.png?size=300x300&set=set1
$faker->avatar('foo', '300x300', 'jpg'); // https://robohash.org/foo.jpg?size=300x300&set=set1
$faker->avatar('foo', '300x300', 'jpg', 'set2'); // https://robohash.org/foo.jpg?size=300x300&set=set2
$faker->avatar('foo', '300x300', 'jpg', 'set2', 'bg2'); // https://robohash.org/foo.jpg?size=300x300&set=set2&bgset=bg2

Bezhanov\Faker\Provider\Commerce

Generates product and department data for e-commerce websites and online stores., (*6)

<?php

$faker = \Faker\Factory::create();
$faker->addProvider(new \Bezhanov\Faker\Provider\Commerce($faker));

$faker->promotionCode; // KillerPromotion257835
$faker->department; // Kids & Games
$faker->department(6); // Games, Industrial, Books & Automotive
$faker->department(3, true); // Jewelry, Music & Shoes
$faker->category; // Computers
$faker->productName; // Small Rubber Bottle

Bezhanov\Faker\Provider\Device

Generates random mobile device specifications, (*7)

<?php

$faker = \Faker\Factory::create();
$faker->addProvider(new \Bezhanov\Faker\Provider\Device($faker));

$faker->deviceBuildNumber; // 186
$faker->deviceManufacturer; // Apple
$faker->deviceModelName; // iPhone 4
$faker->devicePlatform; // Ubuntu Touch
$faker->deviceSerialNumber; // ejfjnRNInxh0363JC2WM
$faker->deviceVersion; // 812

Bezhanov\Faker\Provider\Demographic

Generates random demographic data, such as: race, gender, demonym, educational attainment, height, (*8)

<?php

$faker = \Faker\Factory::create();
$faker->addProvider(new \Bezhanov\Faker\Provider\Demographic($faker));

$faker->race; // Asian
$faker->educationalAttainment; // Master's degree
$faker->demonym; // Bulgarian
$faker->maritalStatus; // Married
$faker->gender; // Female
$faker->height; // 1.99
$faker->height(Demographic::UNIT_TYPE_IMPERIAL); // 7 ft, 2 in

Bezhanov\Faker\Provider\Educator

Generates secondary school and university names, and course names., (*9)

<?php

$faker = \Faker\Factory::create();
$faker->addProvider(new \Bezhanov\Faker\Provider\Educator($faker));

$faker->university; // Clearcourt University
$faker->secondarySchool; // Mallowpond High
$faker->course; // Bachelor of Forensic Science
$faker->campus; // Brighthurst Campus

Bezhanov\Faker\Provider\Food

Generates ingredient names, spice names, and recipe measurements., (*10)

<?php

$faker = \Faker\Factory::create();
$faker->addProvider(new \Bezhanov\Faker\Provider\Food($faker));

$faker->ingredient; // Hazelnut
$faker->spice; // Chamomile
$faker->measurement; // 1 pint

Bezhanov\Faker\Provider\Medicine

Generates fake medicine names., (*11)

<?php

$faker = \Faker\Factory::create();
$faker->addProvider(new \Bezhanov\Faker\Provider\Medicine($faker));

$faker->medicine; // Amphevorin

Bezhanov\Faker\Provider\Placeholder

Generates URLs to placeholder images using the Placeholder.com image placeholder service., (*12)

<?php

$faker = \Faker\Factory::create();
$faker->addProvider(new \Bezhanov\Faker\Provider\Placeholder($faker));

$faker->placeholder(); // https://placehold.it/300x300.png
$faker->placeholder('250x250'); // https://placehold.it/250x250.png
$faker->placeholder('250x250', 'jpg'); // https://placehold.it/250x250.jpg
$faker->placeholder('250x250', 'jpg', 'ff0000'); // https://placehold.it/250x250.jpg/ff0000
$faker->placeholder('250x250', 'jpg', 'f00', '000000'); // https://placehold.it/250x250.jpg/f00/000000
$faker->placeholder('250x250', 'jpg', 'ff0000', '000', 'test'); // https://placehold.it/250x250.jpg/ff0000/000?text=test

Bezhanov\Faker\Provider\Science

Generates names of scientists and chemical elements, (*13)

<?php

$faker = \Faker\Factory::create();
$faker->addProvider(new \Bezhanov\Faker\Provider\Science($faker));

$faker->chemicalElement; // Radium
$faker->chemicalElementSymbol; // Fe
$faker->scientist; // Max Planck

Bezhanov\Faker\Provider\Space

Generates names of astronomical objects, distance measurements, spacecrafts, etc., (*14)

<?php

$faker = \Faker\Factory::create();
$faker->addProvider(new \Bezhanov\Faker\Provider\Space($faker));

$faker->planet; // Neptune
$faker->moon; // Europa
$faker->galaxy; // Andromeda
$faker->nebula; // Orion Nebula
$faker->starCluster; // Palomar 6
$faker->constellation; // Ursa Major
$faker->star; // Luyten 726-8B
$faker->agency; // Japan Aerospace Exploration Agency
$faker->agencyAbv; // NASA
$faker->nasaSpaceCraft; // Atlantis
$faker->spaceCompany; // SpaceX
$faker->distanceMeasurement; // 43 kiloparsecs
$faker->meteorite; // Qidong
$faker->launchVehicle; // Saturn IV

Bezhanov\Faker\Provider\Species

Generates scientific names of fictional bird, animal, and plant species., (*15)

<?php

$faker = \Faker\Factory::create();
$faker->addProvider(new \Bezhanov\Faker\Provider\Species($faker));

echo $faker->bird . PHP_EOL; // Rostratula subis
echo $faker->creature . PHP_EOL; // Latrodectus indri
echo $faker->plant . PHP_EOL; // Pyrus filiformis

Bezhanov\Faker\Provider\Team

Generates sports and sports team names, (*16)

<?php

$faker = \Faker\Factory::create();
$faker->addProvider(new \Bezhanov\Faker\Provider\Team($faker));

$faker->team; // Oregon Tigers
$faker->sport; // soccer

Integrations

Contributing

All contributions are welcome. Before opening PRs, make sure that all tests are passing, and that code coverage is satisfactory:, (*17)

phpunit tests --coverage-html coverage

The Versions

17/05 2018

dev-master

9999999-dev

A collection of custom providers for the Faker library

  Sources   Download

MIT

The Requires

 

The Development Requires

fixtures faker data

17/05 2018

dev-dev

dev-dev

A collection of custom providers for the Faker library

  Sources   Download

MIT

The Requires

 

The Development Requires

fixtures faker data

17/05 2018

1.0.1

1.0.1.0

A collection of custom providers for the Faker library

  Sources   Download

MIT

The Requires

 

The Development Requires

fixtures faker data

12/08 2017

1.0.0

1.0.0.0

A collection of custom providers for the Faker library

  Sources   Download

MIT

The Requires

 

The Development Requires

fixtures faker data

11/08 2017

0.2.0

0.2.0.0

A collection of custom providers for the Faker library

  Sources   Download

MIT

The Requires

 

The Development Requires

fixtures faker data

27/06 2017

0.1.0

0.1.0.0

A collection of custom providers for the Faker library

  Sources   Download

MIT

The Requires

 

The Development Requires

fixtures faker data