Commit Graph

  • 797cbedb27 Add route to create book master Tim 2023-08-17 15:53:58 +0200
  • 7a4a9257c3 Implement doctrine orm as command Tim 2023-08-17 15:41:25 +0200
  • f8d1c66934 Implement commands Tim 2023-08-16 16:04:35 +0200
  • 1ee5c1c992 Add console Tim 2023-08-16 14:33:21 +0200
  • 59200be680 Add doctrine and seperate out the renderer Tim 2023-08-16 14:28:06 +0200
  • 56e8caa26c Add key based genericConfig Tim 2023-08-15 21:21:24 +0200
  • 18848e041f Play around with the rendering Tim 2023-08-15 13:56:04 +0200
  • 24683e70a8 Streamline view rendering Tim 2023-08-15 13:37:03 +0200
  • 45797ba20a Add ViewHelper in view for injecting some basic classes in views Tim 2023-08-15 12:10:04 +0200
  • de5ff3a2b9 Add toUri function to router Tim 2023-08-15 03:17:04 +0200
  • c80dcd2860 Implement simple PHP based view renderer Tim 2023-08-15 03:02:55 +0200
  • 9b8985640c Add appConfig to container diff --git a/public/index.php b/public/index.php index 78fef51..e15604b 100644 --- a/public/index.php +++ b/public/index.php @@ -8,8 +8,7 @@ error_reporting(E_ALL); Tim 2023-08-15 02:16:12 +0200
  • 1aded029fc Add logger diff --git a/src/Http/GenericRouter.php b/src/Http/GenericRouter.php index 334ecac..5a2ac6f 100644 --- a/src/Http/GenericRouter.php +++ b/src/Http/GenericRouter.php @@ -4,6 +4,7 @@ namespace Ardent\Undercurrent\Http; tim 2023-08-11 01:08:05 +0200
  • 42c590dfd6 Finalize routing with injection and parameters diff --git a/app/Controller/HelloWorldController.php b/app/Controller/HelloWorldController.php index 7f2af8b..86c5b8e 100644 --- a/app/Controller/HelloWorldController.php +++ b/app/Controller/HelloWorldController.php @@ -28,13 +28,13 @@ class HelloWorldController return new GenericResponse('Hello World!'); } Tim 2023-08-10 17:57:25 +0200
  • 2fd6e50b90 Start with controller parameter injection diff --git a/src/Http/GenericRouter.php b/src/Http/GenericRouter.php index 23e9311..d5ffb95 100644 --- a/src/Http/GenericRouter.php +++ b/src/Http/GenericRouter.php @@ -22,16 +22,47 @@ class GenericRouter implements RouterInterface public function dispatch(RequestInterface $request): ResponseInterface { foreach ($this->config->getRoutes() as $route) { - if ($route->getRoute()->path === $request->getUri()) { - $controller = $this->container->get($route->getController()); - $method = $route->getMethod(); - return $controller->$method(...$this->autowire($route)); + $params = $this->resolveParams($route->getRoute()->path, $request->getUri()); + + if ($params === null) { + continue; } + + $controller = $this->container->get($route->getController()); + $method = $route->getMethod(); +// $params = $this->autowire($route) + $this->resolveParams($route->getRoute()->path, $request->getUri()); + $params = $this->resolveParams($route->getRoute()->path, $request->getUri()); + return $controller->$method(...$params); } Tim 2023-08-09 18:17:34 +0200
  • 6f247f3ab7 Make route debug more readable tim 2023-08-09 00:59:07 +0200
  • fdd1744b35 Update README tim 2023-08-09 00:55:11 +0200
  • 64ff0c243d Add controller method autowiring diff --git a/app/Controller/HelloWorldController.php b/app/Controller/HelloWorldController.php index 8361e9d..282a990 100644 --- a/app/Controller/HelloWorldController.php +++ b/app/Controller/HelloWorldController.php @@ -5,6 +5,7 @@ namespace App\Controller; use Ardent\Undercurrent\Attribute\Route; use Ardent\Undercurrent\Http\GenericResponse; use Ardent\Undercurrent\Http\ResponseInterface; +use Ardent\Undercurrent\Http\RouterConfig; use Ardent\Undercurrent\Http\StatusEnum; tim 2023-08-09 00:49:47 +0200
  • 5d6ad29db8 Expand the response with headers and set status code Tim 2023-08-08 17:18:18 +0200
  • 7c13318b9a Introduce ClassNotFoundException for container Tim 2023-08-08 16:56:55 +0200
  • a854480ff1 Implement basic version of route matching Make RouteConfig more readable diff --git a/app/Kernel.php b/app/Kernel.php index 4425355..a365d39 100644 --- a/app/Kernel.php +++ b/app/Kernel.php @@ -10,7 +10,7 @@ class Kernel extends BaseKernel { protected function dependencies(ContainerInterface $container): void { - $this->addRoutes($container, [ + $this->addControllers($container, [ BaseController::class, ]); } diff --git a/src/Attribute/Route.php b/src/Attribute/Route.php index 6bbd272..7129654 100644 --- a/src/Attribute/Route.php +++ b/src/Attribute/Route.php @@ -2,13 +2,15 @@ Tim 2023-08-08 16:53:27 +0200
  • 96e833fb4b Move route config to app diff --git a/app/Kernel.php b/app/Kernel.php index 0e8e047..4425355 100644 --- a/app/Kernel.php +++ b/app/Kernel.php @@ -2,8 +2,16 @@ Tim 2023-08-08 15:42:57 +0200
  • a55d1c3c2e Properly implement the router with config and interfaces Expand the container with aliases and argument autowiring Tim 2023-08-07 17:50:34 +0200
  • e9a636554f Add response and request objects and interfaces diff --git a/README.md b/README.md index 4b64da1..c860957 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ Todos: - [ ] Collect routes properly - [ ] Process routes correctly +- [ ] Add request and response objects Tim 2023-08-07 14:23:00 +0200
  • 68ccd37f07 Move public to make it compatible with symfony nginx files Tim 2023-07-28 16:45:32 +0200
  • 503d8c524a First working version with non working routes Tim 2023-07-28 16:14:55 +0200