PHP code example of ivrok / wp-router

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

    

ivrok / wp-router example snippets


use Ivrok\WPRouter\WPRoute;
use Ivrok\WPRouter\WPRouter;

$usersController = new \UsersController();

$router = new WPRouter();
$router->addRoute(new WPRoute("show-users", [$usersController, "index"]));
$router->addRoute(new WPRoute("show-users/{su_id}", fn($suID) => echo $suID));
$router->init();