PHP code example of jarscr / teo

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

    

jarscr / teo example snippets


$router->add('', ['controller' => 'Home', 'action' => 'index']);
$router->add('posts/index', ['controller' => 'Posts', 'action' => 'index']);

$router->add('{controller}/{action}');

$router->add('{controller}/{id:\d+}/{action}');

$router->add('admin/{controller}/{action}', ['namespace' => 'Admin']);

/**
 * Before filter. Return false to stop the action from executing.
 *
 * @return void
 */
protected function before()
{
}

/**
 * After filter.
 *
 * @return void
 */
protected function after()
{
}

View::render('Home/index.php', [
    'name'    => 'Dave',
    'colours' => ['red', 'green', 'blue']
]);

View::renderTemplate('Home/index.html', [
    'name'    => 'Dave',
    'colours' => ['red', 'green', 'blue']
]);

$db = static::getDB();