Overview

Namespaces

  • LucidFrame
    • Console
    • Core
    • File
  • None

Classes

  • App
  • Database
  • Form
  • Middleware
  • Pager
  • QueryBuilder
  • Router
  • SchemaManager
  • Seeder
  • Validation
  • View
  • Overview
  • Namespace
  • Class

Class Router

Simple router for named routes that can be used with RegExp

Namespace: LucidFrame\Core
Located at classes/Router.php
Methods summary
public
# __construct( string $name )

Constructor

Constructor

Parameters

$name
The route name
public static
# getRoutes( )

Getter for $routes

Getter for $routes

public static
# getMatchedName( )

Getter for $matchedRouteName

Getter for $matchedRouteName

public
# getName( )

Getter for $name

Getter for $name

public LucidFrame\Core\Router
# add( string $name, string $path, string $to, string $method = 'GET', array|null $patterns = null )

Define the custom routing path

Define the custom routing path

Parameters

$name
Any unique route name to the mapped $path
$path
URL path with optional dynamic variables such as /post/{id}/edit
$to
The real path to a directory or file in /app
$method
GET, POST, PUT or DELETE or any combination with | such as GET|POST
$patterns
array of the regex patterns for variables in $path such s array('id' => '\d+')

Returns

LucidFrame\Core\Router
public LucidFrame\Core\Router
# map( string $path, string $to, string $method = 'GET', array|null $patterns = null )

Define the custom routing path

Define the custom routing path

Parameters

$path
URL path with optional dynamic variables such as /post/{id}/edit
$to
The real path to a directory or file in /app
$method
GET, POST, PUT or DELETE or any combination with | such as GET|POST
$patterns
array of the regex patterns for variables in $path such s array('id' => '\d+')

Returns

LucidFrame\Core\Router
public static string|boolean
# match( )

Matching the current route to the defined custom routes

Matching the current route to the defined custom routes

Returns

string|boolean
The matched route or false if no matched route is found
public static string|null
# getPathByName( string $name )

Get the path from the given name

Get the path from the given name

Parameters

$name
The route name that is unique to the mapped path

Returns

string|null
public static
# clean( )

Delete all defined named routes

Delete all defined named routes

public static
# group( string $prefix, callable $callback )

Define route group

Define route group

Parameters

$prefix
A prefix for the group of the routes
$callback
The callback function that defines each route in the group
Properties summary
protected static array $routes

The custom routes defined

The custom routes defined

# array()
protected static string $matchedRouteName

The route name matched

The route name matched

#
protected string $name

The route name that is unique to the mapped path

The route name that is unique to the mapped path

#
PHPLucidFrame 3.0 API documentation generated by ApiGen