Getting Started

View Source

Hex.pm Version Hex.pm Downloads Elixir CI

NeoFaker is a fake data generator for Elixir tests and development environments.

Requirements

  • Erlang: 27.0 or newer
  • Elixir: 1.18.0-otp-27 or newer

Installation

Add NeoFaker to your mix.exs dependencies:

def deps do
  [
    {:neo_faker, "~> 0.13.0", only: [:dev, :test]}
  ]
end

Install the dependency:

mix deps.get

Configuration

Set the default locale in your config.exs:

config :neo_faker, locale: :default

If the locale is unavailable, NeoFaker falls back to :default. See the list of supported locales.

Phoenix Projects

For Phoenix apps, set the locale in config/dev.exs or config/test.exs.

In test/test_helper.exs, add:

ExUnit.start()
NeoFaker.start()

Usage

Generate fake data with NeoFaker:

iex> NeoFaker.App.name()
"Neo Faker"

iex> NeoFaker.App.description()
"Fake data generator for Elixir tests and development environments."

iex> NeoFaker.App.description(locale: :id_id)
"Penghasil data palsu untuk pengujian dan lingkungan pengembangan Elixir."

For detailed documentation, see the API Reference. For a quick overview, see the Cheat Sheet.

License

Licensed under the MIT License.