RouteKey
in package
implements
Stringable
Route keys provide the core bindings of the HydePHP routing system as they are what canonically identifies a page.
This class both provides a data object for normalized type-hintable values, and general related helper methods.
In short, the route key is the URL path relative to the site webroot, without the file extension.
For example, _pages/index.blade.php
would be compiled to _site/index.html
and thus has the route key of index
.
As another example, _posts/welcome.md
would be compiled to _site/posts/welcome.html
and thus has the route key of posts/welcome
.
Note that if the source page's output directory is changed, the route key will change accordingly. This can potentially cause links to break when changing the output directory for a page class.
Table of Contents
Interfaces
- Stringable
Properties
- $key : string
Methods
- __construct() : mixed
- __toString() : string
- fromPage() : self
- get() : string
- make() : self
Properties
$key read-only
protected
string
$key
Methods
__construct()
public
__construct(string $key) : mixed
Parameters
- $key : string
__toString()
public
__toString() : string
Return values
stringfromPage()
public
static fromPage(HydePage> $pageClass, string $identifier) : self
Parameters
- $pageClass : HydePage>
- $identifier : string
Return values
selfget()
public
get() : string
Return values
stringmake()
public
static make(string $key) : self
Parameters
- $key : string