A wrapper around faker for factory muffin

Overview

Factory Muffin Faker 2.3

StyleCI Status Build Status Software License Latest Version Total Downloads

The goal of this package is to wrap Faker to make it super easy to use with Factory Muffin.

Note that this library does not actually require Factory Muffin in order to work, so may be used else where too. The whole point of this library is to wrap Faker in closures so the actual generation can be executed at a later point.

Installing

PHP 5.4+ and Composer are required.

In your composer.json, simply add "league/factory-muffin-faker": "^2.3" to your "require-dev" section:

{
    "require-dev": {
        "league/factory-muffin-faker": "^2.3"
    }
}

Contributing

Please check out our contribution guidelines for details.

Credits

Factory Muffin Faker is a wrapper around Faker to make it super easy to use with Factory Muffin, and is currently maintained by Graham Campbell. Thank you to all our wonderful contributors too.

Security

If you discover a security vulnerability within this package, please send an email to Graham Campbell at [email protected]. All security vulnerabilities will be promptly addressed. You may view our full security policy here.

License

Factory Muffin Faker is licensed under The MIT License (MIT).

For Enterprise

Available as part of the Tidelift Subscription

The maintainers of league/factory-muffin-faker and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. Learn more.

Comments
  • unique() doesn't scale

    unique() doesn't scale

    unique() is pretty easy to understand: a global repository of already-generated data, guaranteed not to be repeated. In our application, we have ~400 factories, and about 1k instances of unique() corresponding to database constraint and about 800 unit tests. We easily surpass the 10k limit and even when upping to 100k. It would be immensely helpful to be able to pass a key: unique('table.column')->whatever(). In addition, would be good to have a clear() method when we refresh the database.

    protected function _after()
    {
        Faker::unique()->clear();
    }
    

    If agreed, I can spin up a PR.

    opened by josephzidell 6
  • I dosent install Faker 1.5

    I dosent install Faker 1.5

    when I require the package with composer I figure out that the faker dependency still on 1.4, how I can get 1.5? because I need the Arabic support from faker 1.5 to to generate data!!

    opened by cherifGsoul 5
  • Keep compatibility with Faker

    Keep compatibility with Faker

    I really like FactoryMuffin 3.0. In my opinion a lot of good design decisions were made for the upcoming version.

    What's a show stopper for me at the moment though is very limited compatibility with Faker through the facade. Especially bothering at the current point is one thing. If I'm using Faker directly I can concatenate generated string. So this would work

    $fm->define('Model')->setDefinitions(array(
        'someValue' => $faker->firstName() . ' ' . $faker->randomNumber()
    ));
    

    Using the facade I get an exception, because the returned closure can not be casted to a string.

    $fm->define('Model')->setDefinitions(array(
        'someValue' => Faker::firstName() . ' ' . Faker::randomNumber()
    ));
    

    That's why I'm wondering, why is a closure returned in Faker.php in line 121 (format() method). Why is the result not directly returned like so:

    /**
         * Wrap a faker format in a closure.
         *
         * @param string $formatter The formatter.
         * @param array  $arguments The arguments.
         *
         * @return \Closure
         */
        public function format($formatter, array $arguments = [])
        {
            return $this->getGenerator()->format( $formatter, $arguments );
        }
    

    This would already resolve the issue but I guess there would be other drawbacks?

    opened by Youbility 3
  • Updated faker dependency to 1.8.*

    Updated faker dependency to 1.8.*

    Hi!

    I'm using this package extensively, but the faker version used is getting quite old, almost two years, missing some of the features, but i'm using faker directly also, and get locked on the 1.6 version. I had seen the previous pull request #11 closed and I understand the causes. Maybe you could consider updating a major version to catch up with Faker?

    Thanks

    opened by sspat 1
  • Updated fzaninotto/faker dependency definition

    Updated fzaninotto/faker dependency definition

    Trying to use this library with the latest version of the faker library (v1.7.1) throws a composer error;

    factory-muffin-maker currently requires 1.6.*; changed this to ^1.6

    opened by teliov 1
  • IDE support

    IDE support

    I would be nice if we could have some DocBlocks like @property or @method, along the line of https://github.com/fzaninotto/Faker/blob/master/src/Faker/Generator.php#L6-L174

    opened by krukru 1
  • Add end user ability to extend faker facade and ovverride faker instance

    Add end user ability to extend faker facade and ovverride faker instance

    A few minutes ago I wanted to extend my own Faker instance from factory-muffins Faker to add a phpdoc tags for Faker instance API autocompletion

    But I loosed this ability due to private access modifier on Facade::$instance

    Additionally I don't see a valuable reason to leave it private on

    opened by overflowingd 0
  • Add simple usage

    Add simple usage

    Added a simple use case to let people know how to implement the Faker facade. I create this pull request because I found no documentation about factory-muffin-faker and the only way I found to use it is within the factory-muffin documentation.

    opened by ghost 0
Releases(v2.3.0)
  • v2.3.0(Dec 13, 2020)

    This is the first release in the 2.3.x series.

    This release makes the following changes:
    • Switch to fakerphp/faker:^1.9.1 (#21)
    This release fixes the following regressions:
    • Removed incorrect mixins (#20)
    • Support PHP 8.0 (3b635036c1d27e21c3853344551a3db51366410f)

    https://github.com/thephpleague/factory-muffin-faker/compare/v2.2.2...v2.3.0

    Source code(tar.gz)
    Source code(zip)
  • v2.2.2(Apr 12, 2020)

    This is the second patch release in the 2.2.x series.

    This release fixes the following regressions:
    • Updated funding information (07f55317db9720cd750a196fa8bc41142d8ce0ca)

    https://github.com/thephpleague/factory-muffin-faker/compare/v2.2.1...v2.2.2

    Source code(tar.gz)
    Source code(zip)
  • v2.2.1(Feb 17, 2020)

    This is the first patch release in the 2.2.x series.

    This release fixes the following regressions:
    • Support for PHP 7.4 (9a8009b1838d0ced658920d36ea44edc04e5d579)

    https://github.com/thephpleague/factory-muffin-faker/compare/v2.2.0...v2.2.1

    Source code(tar.gz)
    Source code(zip)
  • v2.2.0(Nov 25, 2019)

    This is the first release in the 2.2.x series.

    This release makes the following changes:
    • Allow Faker ^1.6 (c85d65f4200f32163c6d97dd9203b4130b1b7879)

    https://github.com/thephpleague/factory-muffin-faker/compare/v2.1.0...v2.2.0

    Source code(tar.gz)
    Source code(zip)
  • v2.1.0(Apr 24, 2019)

    This is the first release in the 2.1.x series.

    This release makes the following changes:
    • Allow Faker 1.6-1.8 (93271b578419c8a1da42f0ae41d4aff79c0e22d1)
    • Add docblocks for IDE support (8d1fcff9885c71758f5a63352a993c573be8877b)

    https://github.com/thephpleague/factory-muffin-faker/compare/v2.0.0...v2.1.0

    Source code(tar.gz)
    Source code(zip)
  • v2.0.0(May 13, 2016)

    This is our second major release.

    A major version bump was needed to retain semver compatibility due to upgrading from Faker 1.5 to 1.6. Faker does not follow semver, and their 1.6 release contained breaking changes, hence our major version bump.


    https://github.com/thephpleague/factory-muffin-faker/compare/v1.0.0...v2.0.0

    Source code(tar.gz)
    Source code(zip)
  • v1.0.0(Feb 14, 2016)

  • v1.0.0-RC1(Sep 18, 2015)

    This is the first release candidate for 1.0.0.

    Non-stable releases are not fully documented.


    https://github.com/thephpleague/factory-muffin-faker/compare/v1.0.0-beta1...v1.0.0-RC1

    Source code(tar.gz)
    Source code(zip)
  • v1.0.0-beta1(Dec 22, 2014)

Owner
The League of Extraordinary Packages
A group of developers who have banded together to build solid, well tested PHP packages using modern coding standards.
The League of Extraordinary Packages
WordPlate is a wrapper around WordPress. It makes developers life easier. It is just like building any other WordPress website with themes and plugins. Just with sprinkles on top.

WordPlate is simply a wrapper around WordPress. It makes developers life easier. It is just like building any other WordPress website with themes and plugins. Just with sprinkles on top.

WordPlate 1.7k Dec 24, 2022
This is a simple Wrapper around the ZipArchive methods with some handy functions

Note I haven't updated this package in a long time except merging PRs. The last time I was using this package was with PHP5. I archived the repository

Nils Plaschke 845 Dec 13, 2022
This is a simple Wrapper around the ZipArchive methods with some handy functions

Note I haven't updated this package in a long time except merging PRs. The last time I was using this package was with PHP5. I archived the repository

Nils Plaschke 836 Jan 26, 2022
An object oriented wrapper around PHP's built-in server.

Statix Server Requirements PHP 8 minumum Installation composer require statix/server Basic Usage To get started, ensure the vendor autoload script is

Statix PHP 113 Dec 27, 2022
A PHP wrapper around Libreoffice for converting documents from one format to another.

Document Converter A PHP wrapper around Libreoffice for converting documents from one format to another. For example: Microsoft Word to PDF OpenOffice

Lukas White 0 Jul 28, 2022
A wrapper around symplify/config-transformer used to update recipes and using easy coding standard for generating readable config files.

Symfony Recipes Yaml to PHP Converter This is a wrapper around the symplify/config-transformer used to convert Symfony core recipes which uses .yaml c

Alexander Schranz 3 Nov 24, 2022
A simple wrapper around vlucas' PHP dotenv library for Kirby CMS.

kirby-phpdotenv A simple wrapper around vlucas' PHP dotenv library for Kirby CMS. Why? I've been using .env in my Kirby projects for a while, but I go

Steve Jamesson 5 Feb 6, 2020
Adds factory functions for WooCommerce to be used with wp-browser integration tests.

wp-browser-woocommerce This library simplifies testing of WooCommerce themes and plugins with wp-browser. Several Unit Test Factories are added that a

Level Level 12 Dec 29, 2022
Provides a configuration factory and multiple rule sets for friendsofphp/php-cs-fixer.

php-cs-fixer-config Provides a configuration factory and multiple rule sets for friendsofphp/php-cs-fixer. Installation Run $ composer require --dev e

null 37 Jan 2, 2023
Samsui is a factory library for building PHP objects useful for setting up test data in your applications.

#Samsui Samsui is a factory library for building PHP objects useful for setting up test data in your applications. It is mainly inspired by Rosie for

Sam Yong 31 Nov 11, 2020
This is a plugin for pocketmine-mp, when locking a player's items helps players not to lose items or throw things around causing server lag.

[] LockedItem| v1.0.0 Player's item lock Features Player's item lock Players aren't afraid of losing items For Devolopers You can access to LockedItem

JeroGamingYT 3 Jan 4, 2022
PHP exercises from my course at ETEC and some of my own play-around with PHP

etec-php-exercises PHP exercises from my course at ETEC and some of my own play-around with PHP Translations: Português (BR) Projects Project Descript

Luis Felipe Santos do Nascimento 6 May 3, 2022
Makes indexing of your Magento store around x times faster! ‼️ Maintainers wanted!

FastIndexer This module has never been used in production. No more empty results in the frontend due to a long taking reindex process! Integrates seam

Cyrill Schumacher 79 Jul 10, 2022
⭐ It is an platform for people to help them get connected with the like minding folks around the globe.

Meetups It is an Platform for people to help them get connected with the like minded folks around the globe. Live on Web: Cick here ?? Meet and Connec

Hardik Kaushik 5 Apr 26, 2022
Parse DSN strings into value objects to make them easier to use, pass around and manipulate

DSN parser Parse DSN strings into value objects to make them easier to use, pass around and manipulate. Install Via Composer composer require nyholm/d

Tobias Nyholm 77 Dec 13, 2022
nmap is a PHP wrapper for Nmap.

nmap nmap is a PHP wrapper for Nmap, a free security scanner for network exploration. Usage use Nmap\Nmap; $hosts = Nmap::create()->scan([ 'williamdur

William Durand 151 Sep 24, 2022
A simple API with Guzzle wrapper, providing easy access to wppconnect's endpoints.

WPPConnect Team Wppconnect Laravel Client A simple API with Guzzle wrapper, providing easy access to wppconnect's endpoints. Requirements PHP 7.4 or n

null 28 Dec 18, 2022
AI PHP is a wrapper for rubix ml to make AI very approachable

AI PHP Rubix Wrap A wrapper for Rubix ML to make it very approachable Example: $report = RubixService::train($data, 'column_with_label'); Where co

null 15 Nov 5, 2022
PhpGit - A Git wrapper for PHP 7.1+

PhpGit PhpGit - A Git wrapper for PHP 7.1+ The project is forked from https://github.com/kzykhys/PHPGit Requirements PHP 7.1+ Git Installation Update

PHPPkg 9 Nov 1, 2022