PHP code example of kingzcheung / routing-match

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

    

kingzcheung / routing-match example snippets




use KingzCheung\RoutingMatch\Routing;
$routes = [
            ["method"=>"POST","url"=>"/api/v2/resources"],
            ["method"=>"GET","url"=>"/api/v1/users/:id/roles"],
            ["method"=>"GET","url"=>"/api/v1/users/:id/comments"],
        ];
$n = Routing::create($routes)->matchNode("POST","/api/v1/users");

var_dump($n); // Node or null