# `mix phx_demo.install`
[🔗](https://github.com/thenatespack/phoenix_demo/blob/main/lib/mix/tasks/phx_demo.install.ex#L38)

Sets up phx_demo in a Phoenix app

Automates the README's setup steps:

  * adds `phoenix_test_playwright` (test only)
  * `preferred_envs` for `demo.record` and `phx_demo.piper.setup`
  * config/test.exs: endpoint `server: true`, `:sql_sandbox`, `:phoenix_test` otp_app
  * Ecto sandbox for LiveView (if the app has a Repo): the
    `Phoenix.Ecto.SQL.Sandbox` plug, `:user_agent` in the LiveView socket's
    `connect_info`, and an `on_mount` hook registered for every LiveView
  * test/test_helper.exs: starts Playwright, sets the base URL, and
    excludes demos from plain `mix test`
  * guards Phoenix 1.8's runtime.exs port config so it doesn't override the
    test port
  * an example demo in test/demos/

Edits it can't make safely become notices with the manual step.

## Example

```sh
MIX_ENV=test mix igniter.install phx_demo --only test
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
