PHP code example of kreme201 / file-base-router

1. Go to this page and download the library: Download kreme201/file-base-router 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/ */

    

kreme201 / file-base-router example snippets



patcher = new Kreme201\FileBaseRouter\Dispatcher(dirname(__DIR__) . '/pages');
$template = $dispatcher->dispatch(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH));

if (false !== $template && file_exists($template)) {
    

.
├── pages
│   ├── board
│   │   ├── [id].php
│   │   └── index.php
│   ├── index.php
├── public
│   └── index.php
└── vendor