PHP code example of yiisoft / file-router

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

    

yiisoft / file-router example snippets


    return [
        'middlewares' => [
            // ...
            Router::class,
            \Yiisoft\FileRouter\FileRouter::class,
            // or
            [
                'class' => FileRouter::class,
                'withNamespace()' => ['App'],
                'withBaseControllerDirectory()' => ['Controller'],
            ],
            // ...
        ]
    ];
    

src
  Controller
    User
      Profile
        IndexController.php
      BlogController.php
    UserController.php
    IndexController.php