Skip to content

Commit 7515e0d

Browse files
committed
add fast router as default router
1 parent 2129219 commit 7515e0d

File tree

6 files changed

+35
-10
lines changed

6 files changed

+35
-10
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@
1212

1313
/.idea
1414
/.phpunit.result.cache
15+
16+
/modules

composer.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,20 @@
1616
"require": {
1717
"php": "^7.2.13",
1818
"ext-json": "*",
19-
"antidot-fw/aura-router-adapter": "dev-master",
2019
"antidot-fw/cli": "^1.0.0",
21-
"antidot-fw/container": "0.0.2",
20+
"antidot-fw/container": "^0.0.2",
2221
"antidot-fw/dev-tools": "dev-master",
2322
"antidot-fw/event-dispatcher": "^1.1.0",
24-
"antidot-fw/framework": "dev-master",
23+
"antidot-fw/fast-router-adapter": "dev-master",
24+
"antidot-fw/framework": "^0.0.1",
2525
"antidot-fw/logger": "^1.0.1",
2626
"antidot-fw/symfony-config-translator": "^1.0.0",
2727
"antidot-fw/yaml-config-provider": "dev-master",
2828
"symfony/yaml": "^4.2.7",
2929
"wshafer/psr11-monolog": "@dev"
3030
},
3131
"require-dev": {
32+
"filp/whoops": "^2.5",
3233
"franzl/whoops-middleware": "^1.1",
3334
"phpro/grumphp": "^0.15.0",
3435
"phpstan/phpstan": "^0.11.5",

config/services/dependencies.dev.yaml.dist

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,9 @@ parameters:
66
default:
77
options:
88
level: 0
9+
10+
services:
11+
Antidot\Application\Http\Response\ErrorResponseGenerator:
12+
class: Antidot\Application\Http\Response\ServerRequestErrorResponseGenerator
13+
arguments:
14+
$devMode: 'true'

config/services/dependencies.prod.yaml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
services:
22
App\Application\Http\Handler\HomePage:
3-
# App\Application\Http\Handler\SomeTestClass:
4-
# arguments:
5-
# $dispatcher: '@another.dispatcher'
3+
App\Application\Http\Handler\SomeMiddleware:
64
App\Application\EventListener\SomeEventListener:
75
tags:
86
- { name: 'event_listener', event: 'App\Application\Event\SomeEvent' }
97

10-
# another.dispatcher:
11-
# factory: Antidot\Event\Container\EventDispatcherFactory
12-
#
138
some.command:
149
class: App\Application\Command\SomeCommandExample
1510
tags:

router/routes.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Antidot\Application\Http\Application;
66
use App\Application\Http\Handler\HomePage;
7+
use App\Application\Http\Handler\SomeMiddleware;
78
use Psr\Container\ContainerInterface;
89

910
/**
@@ -20,5 +21,5 @@
2021
* $app->route('/contact', App\Handler\ContactHandler::class, ['GET', 'POST', ...], 'contact');
2122
*/
2223
return static function (Application $app, ContainerInterface $container) : void {
23-
$app->get('/', [HomePage::class], 'home');
24+
$app->get('/', [SomeMiddleware::class, HomePage::class], 'home');
2425
};
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace App\Application\Http\Handler;
6+
7+
use Psr\Http\Message\ResponseInterface;
8+
use Psr\Http\Message\ServerRequestInterface;
9+
use Psr\Http\Server\MiddlewareInterface;
10+
use Psr\Http\Server\RequestHandlerInterface;
11+
12+
class SomeMiddleware implements MiddlewareInterface
13+
{
14+
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
15+
{
16+
$request = $request->withAttribute('foo', 'Hello World!!!');
17+
18+
return $handler->handle($request);
19+
}
20+
}

0 commit comments

Comments
 (0)