-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfactories.php
More file actions
49 lines (44 loc) · 1.12 KB
/
factories.php
File metadata and controls
49 lines (44 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
declare(strict_types=1);
use Noem\Container\Attribute\Tag;
use Noem\Http\Attribute\Route;
use Psr\Http\Message\ServerRequestInterface;
return [
'acme.route.home' =>
#[Route('/')]
fn() => function () {
echo <<<HTML
<html>
<head></head>
<body>
<h1>Hello World, Noem here</h1>
<ul>
<li><a id="cats" href="/Cats">Cats</a></li>
<li><a href="/Dogs">Dogs</a></li>
<li><a href="/Turtles">Turtles</a></li>
<li><a href="/Goldfish">Goldfish</a></li>
</ul>
</body>
</html>
HTML;
},
'acme.route.page' =>
#[Route('/{page}')]
fn() => function (ServerRequestInterface $request) {
echo <<<HTML
<html>
<head></head>
<body>
<h1>My thoughts about {$request->getAttribute('page')}</h1>
<p>The are pretty cool</p>
<a href="/">Back to home</a>
</body>
</html>
HTML;
},
'simple-exception-handler' =>
#[Tag('exception-handler')]
fn() => function (Throwable $e) {
echo '<pre>' . var_dump($e, true) . '</pre>';
}
];