PhoenixKit.Install.RouterIntegration (phoenix_kit v1.7.66)

Copy Markdown View Source

Handles router integration for PhoenixKit installation.

This module provides functionality to:

  • Find and validate Phoenix router modules
  • Add PhoenixKit imports and routes to routers
  • Generate demo page routes
  • Handle router integration warnings and notices

Summary

Functions

Adds PhoenixKit integration to the Phoenix router.

Verifies and fixes the position of phoenix_kit_routes() in the router.

Functions

add_router_integration(igniter, custom_router_path)

Adds PhoenixKit integration to the Phoenix router.

Parameters

  • igniter - The igniter context
  • custom_router_path - Custom path to router file (optional)

Returns

Updated igniter with router integration or warnings if router not found.

verify_and_fix_router_position(igniter, custom_router_path)

Verifies and fixes the position of phoenix_kit_routes() in the router.

During updates, checks if phoenix_kit_routes() is positioned AFTER catch-all routes (/:param or /*path patterns) and automatically moves it BEFORE them.

Parameters

  • igniter - The igniter context
  • custom_router_path - Custom path to router file (optional)

Returns

Updated igniter with router position fixed or unchanged if already correct.