Thorm
Get started
Get Started in 5 minutes
First Page
Your first page
The controller
Header
Hero section
Contact section
The API
Considerations
Docs
Overview
Guides
Intro
Atoms
Node builders
Props helpers
State + expressions
Expression builder
Events + actions
Effects + targets
API
Api
Examples
Roadmap
Blog
Community
Get Started
GitHub
Router
Route matching with path params, query strings, links, and programmatic navigation.
PHP
📄 Copy code
<?php $base = '/examples/router/'; $Home = el('div', [], [ el('h1', [], [ text('Home') ]), link($base.'search?q=chair', [ cls('btn btn-primary m-3') ], [ text('Search "chair"') ]), el('p', [], [ text('Go to Auction 42: '), link($base.'auction/42', [], [ text('open') ]), ]), ]); $Auction = el('div', [], [ el('h1', [], [ text(concat('Auction ', param('id'))) ]), el('button', [ cls('btn btn-primary m-3'), on('click', navigate($base)), attrs(['id'=>'back-button']), ], [ text('Back') ]), // programmatic back to search preset: el('button', [ cls('btn btn-warning'), on('click', navigate(concat($base, 'search?q=table'))), attrs(['id'=>'search-button']), ], [ text('Search tables') ]), ]); $Search = el('div', [], [ el('h1', [], [ text('Search') ]), el('p', [], [ text(concat('q=', query('q'))) ]), link($base, [cls('btn btn-primary m-3')], [ text('Home') ]), ]); $NotFound = el('h1', [], [ text('Page Not Found.. why oh why???') ]); $app = el('div' ,[ cls('container my-5') ], [ client( route([ $base => $Home, $base . 'auction/:id' => $Auction, $base . 'search' => $Search, ], $NotFound) ), ]);