Search documentation of phoenix_kit

# PhoenixKitWeb.Plugs.Integration (phoenix_kit v1.7.87)

Copy Markdown View Source

Central integration plug for PhoenixKit.

This plug serves as a single entry point for all PhoenixKit plugs that need to run in the parent application's browser pipeline. It coordinates multiple sub-plugs and ensures they run in the correct order.

## Current Features

- Maintenance Mode: Intercepts requests when maintenance mode is enabled
- WebSocket Transport Fix: Clears cached LongPoll fallback preferences to ensure WebSocket is always tried first, providing much better LiveView performance

## Future Extensions

This plug can be extended to include additional PhoenixKit features such as:

- Rate limiting
- Security headers
- Analytics tracking
- Custom middleware

## Usage

This plug is automatically added to your `:browser` pipeline during installation:

    pipeline :browser do
      plug :accepts, ["html"]
      plug :fetch_session
      plug :put_root_layout, html: {MyAppWeb.Layouts, :root}
      plug :protect_from_forgery
      plug :put_secure_browser_headers
      plug PhoenixKitWeb.Plugs.Integration  # ← Added automatically
    end

## Performance

Each sub-plug is optimized to be a no-op when its feature is disabled, ensuring zero performance impact when features are not in use.

## Summary

### Functions

call(conn, opts)

Runs all PhoenixKit integration plugs in sequence.

init(opts)

Initializes the plug with options.

## Functions

# call(conn, opts)

Runs all PhoenixKit integration plugs in sequence.

# init(opts)

Initializes the plug with options.