mix phoenix_kit.install (phoenix_kit v1.7.202)

Copy Markdown View Source

Igniter installer for PhoenixKit.

This task automatically installs PhoenixKit into a Phoenix application by:

  1. Auto-detecting and configuring Ecto repo
  2. Setting up mailer configuration for development and production
  3. Modifying the router to include PhoenixKit routes

Usage

The recommended one-command install (adds the dep, fetches, and runs this task):

mix igniter.install phoenix_kit

Requires the igniter_new archive (one-time setup, same as phx_new):

mix archive.install hex igniter_new

If :phoenix_kit is already in your project's deps, run the task directly:

mix phoenix_kit.install

With custom options:

mix igniter.install phoenix_kit --repo MyApp.Repo --router-path lib/my_app_web/router.ex

Options

  • --repo - Specify Ecto repo module (auto-detected if not provided)
  • --router-path - Specify custom path to router.ex file
  • --prefix - Specify PostgreSQL schema prefix (defaults to "public"). Must match [a-z_][a-z0-9_]* (validated; the install aborts otherwise). A non-public prefix is persisted as config :phoenix_kit, prefix: (in config.exs and test.exs), baked into the generated migration, and written into the generated Oban config as prefix:.
  • --create-schema - Create schema if using custom prefix (default: true for non-public prefixes)

Auto-detection

The installer will automatically:

  • Detect Ecto repo from :ecto_repos config or common naming patterns (MyApp.Repo). With MULTIPLE repos detected, the install halts and requires --repo (guessing between e.g. a runtime repo and a migration-only repo is unsafe)
  • Find main router using Phoenix conventions (MyAppWeb.Router)
  • Configure Swoosh.Adapters.Local for development in config/dev.exs
  • Provide production mailer setup instructions

Note about warnings

You may see a compiler warning about "unused import PhoenixKitWeb.Integration". This is normal behavior for Elixir macros and can be safely ignored. The phoenix_kit_routes() macro is properly used and will expand correctly.