Faker + CakePHP = gourmet/faker
Some time ago, I did some work on Faker to add built-in support for CakePHP’s awesome new ORM. It has just
been merged, and I released gourmet/faker to make it even easier to use.
Here’s how to install it:
At this point, Faker can already be used anywhere in the application. Here’s an example for seeding 20 records in
Posts table (i.e. in a migration file):
It could also be used to auto-generate records in fixtures like so:
What’s cool about this fixture is that it supports the default
TestFixture inserting of custom records.
Here’s how it works under the hood:
That’s it! Happy faking :)