API Reference Routex v1.2.0-rc.0

View Source

Modules

Routex enhances the Phoenix Router by providing an extension-driven framework for advanced routing capabilities. It simplifies route manipulation, offering features such as internationalization (i18n), localization (l10n), translated (multilingual) URLs, and alternative route generation.

Provides an interface to access and update Routex attributes in routes, sockets, or connections (hereinafter containers).

use Routex.Backend

When used, this module generates a Routex backend module and a configuration struct by running the configure/2 callbacks of the extensions provided in opts.

Provides a function to build branched variants of macro's

Provides functions to aid during development

Specification for composable Routex extensions.

Creates helper functions to get a list of maps alternative slugs and their Routex.Attrs by providing a binary url. Sets match?: true for the url matching record.

Creates alternative routes based on branches configured in a Routex backend module. Branches can be nested and each branch can provide Routex.Attrs to be shared with other extensions.

Struct for flattened branch

Struct for branch with optionally nested branches

Module to create and validate a Config struct

Raised when the custom attributes of branches do not have the same keys.

Raised when the branch map does not start with the root branch "/".

Extracts Routex.Attrs from a route and makes them available in components and controllers with the assigns operator @ (optionally under a namespace).

Creates helper functions to get the Routex.Attrs given a binary url or a list of path segments. Use this to lazy load attributes instead of adding them upfront to assigns.

Adapter for projects using :ex_cldr. It generates the configuration for Routex.Extension.Alternatives.

Transforms routes to be unrecognizable.

A route may be defined with a routes Routex.Attrs interpolated into it. These interpolations are specified using the usual #{variable} interpolation syntax. Unlike some other routing solutions, interpolation is not restricted to the beginning of routes.

Raised when a list of routes contains routes with the same path and verb.

Attach LiveView hooks provided by Routex extensions.

Provides integration for plugs defined by Routex extensions.

This module provides route helpers that support the automatic selection of alternative routes. These helpers can serve as drop-in replacements for Phoenix's default route helpers.

The RuntimeCallbacks extension enable to configure callback functions -triggered by the Plug pipeline and LiveViews handle_params- by providing a list of {module, function, arguments} tuples. This is particularly useful for integrating with internationalization libraries like

Experimental

This module is experimental and may be subject to change

Main module for locale detection logic.

Extracts locale information from various sources. Handles both Plug.Conn structs and map inputs.

Handles parsing of locale strings and accept-language headers. Uses efficient binary pattern matching and follows RFC 5646 BCP 47 language tag format.

Pre-generated locale registry shipped with Routex. Generated from IANA Language Subtag Registry.

Type definitions for locale detection.

Enables users to enter URLs using localized terms which can enhance user engagement and content relevance.

Supports the use of original route paths in controllers and templates while rendering transformed route paths at runtime without performance impact.

Provides fallback functions when use'd

Matchables are an essential part of Routex. They are used to match run time routes with compile time routes and enable reordered route segments.

This module provides everything needed to process Phoenix routes. It executes the transform callbacks from extensions to transform Phoenix.Router.Route structs and create_helpers callbacks to create one unified Helper module.

Function for working with Routex augmented Phoenix Routes

Provides macro (callbacks) to alter route definition before compilation.

Types shared by Routex core and extensions.

Provides an interface to functions which can be used in extensions.