Faker VersionLicenseBuild StatusIssuesDownloadsDonation

Faker is a pure Elixir library for generating fake data.

Quickstart

  • add {:faker, "~> 0.7"} to your deps in mix.exs;
  • add :faker to list of your applications;
  • jump to usage examples.

Example mix.exs:

...
  def application do
    [applications: [:logger, :faker]]
  end
...
  defp deps do
    [{:faker, "~> 0.7"}]
  end
...

Install

In your mix.exs file, add the :faker project to your dependencies (optionally include the version):

  defp deps do
    [{:faker, "~> 0.5", only: :test}]
  end

Do a mix deps.get to fetch the dependency. That’s it.

If you want to use faker outside tests remove , only: :test part.

Requirements

  • OTP18+
  • Elixir 1.1+

Usage

You need to start :faker application, but due to the many usages of fake data, (seed database, tests, etc) there’s no right place to do it. For example, if you want to use it in tests, just add Faker.start to test/test_helper.exs, then, use any function described in the documentation or in usage examples.

Troubleshooting

  • If you get a message like the one below when you call Faker.Address.city, you need to add :faker to your application’s mix file, in the applications function, as above.
** (FunctionClauseError) no function clause matching in Faker.Address.city_count/1
    lib/faker/address.ex:48: Faker.Address.city_count(nil)
    lib/faker/address.ex:41: Faker.Address.city/0

Tools

Faker was designed as a lightweight library, that’s why it can be easily used with other tools.

Templating

You can build templates for testing purposes with the Blacksmith project. See the Blacksmith readme for details.

Thanks

Sponsored by Evil Martians

License

Released under the MIT License.

Related Repositories

Faker

Faker

Faker is a PHP library that generates fake data for you ...

faker

faker

Faker is a Python package that generates fake data for you. ...

java-faker

java-faker

Brings the popular ruby faker gem to Java ...

django-faker

django-faker

Django-faker uses fake-factory to generate test data for Django models and templates ...

faker-cs

faker-cs

C# port of the Ruby Faker gem (http://faker.rubyforge.org/) ...


Top Contributors

igas saulecabrera whatyouhide GesJeremie johnhamelink lowks orieken rodrigues vforvova bryanjos belaustegui efexen jarednorman piton4eg petehamilton ReadmeCritic rbeene devshane tbash trestrantham zmoshansky batate

Releases

-   v0.7.0 zip tar
-   v0.6.0 zip tar
-   v0.5.1 zip tar
-   v0.5.0 zip tar
-   v0.4.1 zip tar
-   v0.4.0 zip tar
-   v0.3.2 zip tar
-   v0.3.1 zip tar
-   v0.3.0 zip tar
-   v0.2.0 zip tar
-   v0.1.0 zip tar
-   0.6.0 zip tar