PHP code example of cherry-project / router

1. Go to this page and download the library: Download cherry-project/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/ */

    

cherry-project / router example snippets




define('__ROOT__', __DIR__);

define('CONFIG_FILE', __DIR__ . '/config/config.json');

$config = file_get_contents(CONFIG_FILE)
    or die("Unable to open config file!");

$config = json_decode($config, 1);

foreach ($config as $k => $v)
    define($k, __DIR__ . '/' . $v);

public function sayHello($name)
{
    echo "Hello, {$name}";
}