From ad4e19510aafbae7b035cdded6827ae1fc2ded1d Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Sat, 18 Jan 2025 13:04:06 +0300 Subject: [PATCH 1/4] Define that file router is better to be placed after regular router in middleware config --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e9f6734..0de62d7 100644 --- a/README.md +++ b/README.md @@ -35,8 +35,9 @@ composer require yiisoft/file-router ```php return [ - 'middlewares' => [ + 'middlewares' => [ // ... + Router::class, \Yiisoft\FileRouter\FileRouter::class, // or [ @@ -49,7 +50,10 @@ composer require yiisoft/file-router ]; ``` -2. [Configure the router](docs/guide/en#configuration) for your needs. +2. [Configure the file router](docs/guide/en#configuration) for your needs. + +Note that `FileRouter` goes after regular `Router` so it serves as a fallback in case explicitly defined route +is not found. By default, the following structure of the app could be used assuming `App` points to `src` directory: From 68ad144f3a3c29eebc9bb6d586a0964710f20db5 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Sat, 18 Jan 2025 13:13:22 +0300 Subject: [PATCH 2/4] Typos --- .github/CONTRIBUTING.md | 2 +- .github/SECURITY.md | 2 +- config/web.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 28737bd..938a954 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -19,5 +19,5 @@ Since Yii 3 consists of many packages, we have a [special development tool](http If you don't have any particular package in mind to start with: - [Check roadmap](https://github.com/yiisoft/docs/blob/master/003-roadmap.md). -- Check package issues at github. Usually there are some. +- Check package issues at GitHub. Usually there are some. - Ask @samdark. diff --git a/.github/SECURITY.md b/.github/SECURITY.md index ba09318..6e6618c 100644 --- a/.github/SECURITY.md +++ b/.github/SECURITY.md @@ -3,4 +3,4 @@ Please use the [security issue form](https://www.yiiframework.com/security) to report to us any security issue you find in Yii. DO NOT use the issue tracker or discuss it in the public forum as it will cause more damage than help. -Please note that as a non-commercial OpenSource project we are not able to pay bounties at the moment. +Please note that as a non-commercial OpenSource project, we are not able to pay bounties at the moment. diff --git a/config/web.php b/config/web.php index 69d387a..f0de4ff 100644 --- a/config/web.php +++ b/config/web.php @@ -9,7 +9,7 @@ use Yiisoft\Middleware\Dispatcher\MiddlewareFactory; return [ - FileRouter::class => function (ContainerInterface $container) { + FileRouter::class => static function (ContainerInterface $container) { $eventDispatcher = $container->has(EventDispatcherInterface::class) ? $container->get(EventDispatcherInterface::class) : null; From 782f1c9e123f3097ca2862cfad191761666f6156 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Sat, 18 Jan 2025 13:15:31 +0300 Subject: [PATCH 3/4] Update description --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 9ab7272..d66313c 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "yiisoft/file-router", "type": "library", - "description": "File based router", + "description": "Convention-based file structure router", "keywords": [ "file-router", "router", From 30eceb2f82c7e002b0a7d6b60dc8574272709e77 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Sat, 18 Jan 2025 13:24:09 +0300 Subject: [PATCH 4/4] Better note formatting --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0de62d7..0307d98 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ composer require yiisoft/file-router ```php return [ - 'middlewares' => [ + 'middlewares' => [ // ... Router::class, \Yiisoft\FileRouter\FileRouter::class, @@ -52,8 +52,8 @@ composer require yiisoft/file-router 2. [Configure the file router](docs/guide/en#configuration) for your needs. -Note that `FileRouter` goes after regular `Router` so it serves as a fallback in case explicitly defined route -is not found. +> Note: `FileRouter` goes after regular `Router` to serve as a fallback in case explicitly defined route + is not found. By default, the following structure of the app could be used assuming `App` points to `src` directory: