PHP code example of alejoluc / via

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

    

alejoluc / via example snippets



use alejoluc\Via\RouterFacade as Router;

// [Set up Router (see file in examples) 

Router::get('login', ['LoginController', 'showForm']);
Router::group('admin/', function(){
    Router::get('createUser', ['UsersController', 'createForm']);
}, ['isLoggedIn']);


use alejoluc\Router\Router;
$router = new Router();
$q = isset($_GET['q']) ? $_GET['q'] : '/';
$router->setRequestString($q);

$router->get('/about', 'About Page'); // Will respond to /index.php?q=/about