PHP Classes

File: routes/web-routes.local.php.example

Recommend this page to a friend!
  Packages of Matthew Asham   Binkterm PHP   routes/web-routes.local.php.example   Download  
File: routes/web-routes.local.php.example
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Binkterm PHP
Bulletin board system based on the Web
Author: By
Last change:
Date: 5 days ago
Size: 1,155 bytes
 

Contents

Class file image Download
<?php /** * Local/Custom Routes * * Copy this file to web-routes.local.php to add custom routes. * This file is automatically included by web-routes.php if it exists. * * Your custom routes here won't be overwritten when updating BinktermPHP. */ use BinktermPHP\Auth; use BinktermPHP\Template; use Pecee\SimpleRouter\SimpleRouter; // Example: Custom page route // SimpleRouter::get('/mypage', function() { // $auth = new Auth(); // $user = $auth->getCurrentUser(); // // if (!$user) { // return SimpleRouter::response()->redirect('/login'); // } // // $template = new Template(); // $template->renderResponse('mypage.twig', [ // 'custom_variable' => 'Hello World' // ]); // }); // Example: Public page (no auth required) // SimpleRouter::get('/about', function() { // $template = new Template(); // $template->renderResponse('about.twig'); // }); // Example: Admin-only page // SimpleRouter::get('/admin/custom', function() { // $auth = new Auth(); // $user = $auth->requireAdmin(); // // $template = new Template(); // $template->renderResponse('admin_custom.twig'); // });