PHP code example of lizzyman04 / file-router-symfony

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

    

lizzyman04 / file-router-symfony example snippets


// routes/pages/users/[id].php

// @methods GET, PUT

use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;

return function (Request $request, array $params) {
    return new JsonResponse([
        'id'     => $params['id'],
        'method' => $request->getMethod(),
    ]);
};