PHP code example of presprog / kirby-route-attributes

1. Go to this page and download the library: Download presprog/kirby-route-attributes 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/ */

    

presprog / kirby-route-attributes example snippets


// site/routes/my-awesome-route.php


use Kirby\Http\Response;
use PresProg\RouteAttributes\Attributes\Get;

return #[Get('/foo/(:all)')] function ($all) {
    return new Response("<h1>$all</h1>", null, 200);
};

// site/routes/my-awesome-route.php


use Kirby\Http\Response;
use PresProg\RouteAttributes\Attributes\Route;

return #[Route('/foo/(:all)', 'GET')] function ($all) {
    return new Response("<h1>$all</h1>", null, 200);
};