Skip to content

ModuleRoute

Route group for one MVC module, optionally scoped by hostname and locale.

The group registers the conventional PhalconKit routes for: - module root - controller index - controller/action/params

When locales are provided, it also registers locale-prefixed variants using both one regex route and concrete per-locale route names. Hostname groups use host-derived route names so generated routes do not collide with path-based module routes.


  • Full name: \PhalconKit\Mvc\Router\ModuleRoute
  • Parent class: Group

See Also:

  • https://docs.phalcon.io/latest/routing/

Properties

locale

Allowed locale prefixes for this module route group.

public list<string> $locale

Methods

__construct

Create a module route group.

public __construct(array<string,mixed>|string|null $paths = null, list<string> $locale = [], string|null $hostname = null): mixed

Parameters:

Parameter Type Description
$paths array|string|null Native Phalcon route
paths. PhalconKit expects at least module in normal module usage.
$locale list Locale prefixes to register.
$hostname string|null Optional hostname constraint.

initialize

Register default, controller, action, and locale-aware routes.

public initialize(): void

The method is called by Phalcon's router group lifecycle after construction. Route names are deterministic so applications can generate URLs for either plain module routes or locale/hostname-specific routes.