featureflow-elixir-sdk
Elixir SDK for the featureflow feature management platform
Get your Featureflow account at featureflow.io
Get Started
The easiest way to get started is to follow the Featureflow quick start guides
Alternatively to see featureflow running in action, you can run the example in this repo:
- Clone this repository
- Copy config/dev.exs.sample to config/dev.exs
-
Update confid/dev.exs
apiKey: [ "your-javascript-environment-sdk-key"] -
Run
$ mix do deps.get, compileand$ iex -S mix - Have fun!
Installation
The SDK is available on
.
You can either add it as a dependency in your mix.exs, or install it globally as an archive task.
To add it to a mix project, just add a line like this in your deps function in mix.exs:
defp deps do
[{:featureflow, "~> 0.1.0"}]
endand run
mix do deps.get, deps.compileUsage
Here is a simple example of running your feature that prints "I'm enables" on the screen.
defmodule MySimpleFeature do
alias Featureflow.{User, Client}
alias Featureflow.Client.Evaluate
def evaluate_my_feature(%User{} = user) do
api_key = "<your-javascript-environment-sdk-key>"
api_key
|> Featureflow.init()
|> Client.evaluate(:'some-cool-feature', user)
|> Evaluate.isOn()
|> maybe_evaluate_my_feature()
end
def maybe_evaluate_my_feature(true) do
# Execute your feature code here
IO.inspect "Feature evaluated"
end
def maybe_evaluate_my_feature(_), do: nil
end