PHP code example of agrandesr / agile-router

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

    

agrandesr / agile-router example snippets




grandesr\Router;

$router = new Router();

$router->run();

 bash
php -S localhost:8000
json
{
    "params":{
        "POST":{
            "req_headers":["x-header"],
            "req_parameters":["param"],
            "req_body":["id","data.name","data.surname"],
            "render":{
                "type":"json",
                "content":{
                    "header":"^x-header^",
                    "param":"?param?",
                    "showAll":false,
                    "body":{
                        "id":"$id$",
                        "data": {
                            "name":"$data.name$",
                            "surname":"$data.surname$"
                        }
                    }
                }
            }
        }
    }
}