Route annotations with PHP8 attributes

Hello community,

I developed a tiny little utility plugin that allows you to use PHP8 attributes to annotate your routes. Also, I never liked the fact that routes (at least the actual route logic) lives in the config files. If you dislike this, too, you may now implement them in site/routes :slight_smile:

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

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

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

Best from Düsseldorf
Benedict (Present Progressive)

2 Likes