# `PhoenixKitWeb.Plugs.Integration`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.111/lib/phoenix_kit_web/plugs/integration.ex#L1)

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.

# `call`

Runs all PhoenixKit integration plugs in sequence.

# `init`

Initializes the plug with options.

---

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