thephpleague / factory-muffin-faker Goto Github PK
View Code? Open in Web Editor NEWA wrapper around faker for factory muffin
Home Page: https://factory-muffin.thephpleague.com/
License: MIT License
A wrapper around faker for factory muffin
Home Page: https://factory-muffin.thephpleague.com/
License: MIT License
Are there any particular advantages over using factory-muffin-faker
over the faker package it wraps around?
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?
subject
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!!
@philsturgeon Is there any chance you could enable travis, scrutinizer, and add the packagist hook.
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.
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.