PHP code example of anshu-krishna / template-server
1. Go to this page and download the library: Download anshu-krishna/template-server library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
anshu-krishna / template-server example snippets
use KriTS\Server;
use KriTS\RouteExpression as RE;
use KriTS\RouteNode as RN;
// Initilise the server
/*
Server::init(?string $templates_path = null, ?string $routes_path = null) : void;
*/
Server::init();
// Define the routes
/*
execute(RouteNode $root) : never
*/
Server::execute(new RN(
"root_start",
"root",
"root_end",
new RE('404', new RN(
"404_start",
"404",
"404_end"
)))
);