diff options
Diffstat (limited to 'routes/user.php')
| -rw-r--r-- | routes/user.php | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/routes/user.php b/routes/user.php new file mode 100644 index 0000000..5532448 --- /dev/null +++ b/routes/user.php @@ -0,0 +1,30 @@ +<?php + +use Digitigrade\HttpResponseStatus\NotFound; +use Digitigrade\Model\Actor; +use Digitigrade\Router; + +Router::getInstance()->mount('/@/:handle', function (array $args) { + $actor = Actor::findLocalByHandle($args['handle']); + if ($actor == null) { + throw new NotFound("i don't know any local user called " . $args['handle']); + } + + ?> + <!DOCTYPE html> + <html> + + <head> + <title><?= $actor->displayName ?> (@<?= $actor->handle ?>)</title> + </head> + + <body> + <h1><?= $actor->displayName ?></h1> + <p>@<?= $actor->handle ?></p> + <hr> + <p><?= $actor->bio ?></p> + </body> + + </html> + <?php +});
\ No newline at end of file |
