Basics

Routing

Structure actions

PHP routers streamline web traffic direction, providing a structured way to handle URL paths and map them to specific actions or controllers. This modular approach enhances code organization  and scalable applications without altering the core code. This system incorporates the package available at https://github.com/bramus/router

$router->get('/hello/(\w+)', function($name) {
  $content = 'Hello ' . $name;
  include \Ivy\Template::file('include/hello.php', $content);
});

When a user accesses a URL matching the pattern '/hello/{name}', where {name} is a segment of word characters (e.g., '/hello/world'), the provided callback function is executed.