From 6866c1e3471eb09a6893030388251cae7956bba5 Mon Sep 17 00:00:00 2001 From: Spelunky Date: Sun, 15 Feb 2026 02:43:42 +0100 Subject: [PATCH] =?UTF-8?q?Fix:=20Passe=20Namespaces=20f=C3=BCr=20HelloCon?= =?UTF-8?q?troller=20und=20RoutesController=20auf=20App\Controller=20an,?= =?UTF-8?q?=20Demo-Code=20sauber=20getrennt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 5 +++-- .../app}/Controller/HelloController.php | 2 +- .../app}/Controller/RoutesController.php | 2 +- {public => example/public}/index.php | 2 +- {routes => example/routes}/web.php | 14 +++++++++----- 5 files changed, 15 insertions(+), 10 deletions(-) rename {src => example/app}/Controller/HelloController.php (88%) rename {src => example/app}/Controller/RoutesController.php (97%) rename {public => example/public}/index.php (96%) rename {routes => example/routes}/web.php (94%) diff --git a/composer.json b/composer.json index 4f49a40..c37f18b 100644 --- a/composer.json +++ b/composer.json @@ -5,12 +5,13 @@ "require": {}, "autoload": { "psr-4": { - "MyCodebox\\MariaCore\\": "src/" + "MyCodebox\\MariaCore\\": "src/", + "App\\Controller\\": "example/app/Controller/" } }, "scripts": { "dump": "composer dump-autoload", - "serve": "php -S localhost:8080 -t public" + "serve": "php -S localhost:8080 -t example/public" }, "config": { "sort-packages": true, diff --git a/src/Controller/HelloController.php b/example/app/Controller/HelloController.php similarity index 88% rename from src/Controller/HelloController.php rename to example/app/Controller/HelloController.php index 49991ac..abd28e8 100644 --- a/src/Controller/HelloController.php +++ b/example/app/Controller/HelloController.php @@ -1,6 +1,6 @@ get('/', function (Request $request, array $params) { return (new Response())->withHtml('

Willkommen auf der Startseite!

'); }); -$router->get('/routes', [$routeController, 'json']); -$router->get('/routes.html', [$routeController, 'html']); +$router->get('/routes', [$routesController, 'json']); + + + +$router->get('/routes.html', [$routesController, 'html']); + $router->get('/protected', function (Request $request, array $params) { return (new Response())->withJson(['message' => 'Du bist authentifiziert!']);