PHP code example of jossuer / auto_router

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

    

jossuer / auto_router example snippets



t_path = "";
$default_controller = "Home";
$default_method = "index";
$namespace = "\\Controllers\\";
$controllerSuffix = "Controller";

use AutoRouter\Router;

$router = new Router();
$router->setRootPath($root_path)
    ->setDefaultController($default_controller)
    ->setDefaultMethod($default_method)
    ->setNamespace($namespace)
    ->setControllerSuffix($controllerSuffix); 
$router->exec();

class HomeController
{
    function loginAction(){
        ...
    }
    
}

Models/
    ...
Views/
    ...
Controllers/
	MainController.php
	HomeController.php
	OtherController.php
	...
.htaccess		
index.php