From 3a90d44cccafabf28e53aa7d8997366ad945f895 Mon Sep 17 00:00:00 2001 From: lotyp Date: Thu, 13 Jun 2024 16:16:57 +0300 Subject: [PATCH] feat: deptrac and infra layer --- .github/assets/deptrac.svg | 58 +++++++++---------- README.md | 22 +++++++ app/composer.json | 1 + app/deptrac.yaml | 11 +++- app/psalm-baseline.xml | 7 ++- .../Public/Category/Queries/IndexQuery.php | 2 +- .../Filters/FuzzyFilter.php | 2 +- app/src/Support/StringUtils.php | 16 +++++ app/tests/src/Functional/Support/.gitkeep | 0 .../Functional/Support/StringUtilsTest.php | 23 ++++++++ 10 files changed, 109 insertions(+), 33 deletions(-) rename app/src/{Support => Infrastructure}/Filters/FuzzyFilter.php (96%) create mode 100644 app/src/Support/StringUtils.php delete mode 100644 app/tests/src/Functional/Support/.gitkeep create mode 100644 app/tests/src/Functional/Support/StringUtilsTest.php diff --git a/.github/assets/deptrac.svg b/.github/assets/deptrac.svg index cb871ae4..94824434 100644 --- a/.github/assets/deptrac.svg +++ b/.github/assets/deptrac.svg @@ -4,67 +4,67 @@ - + - + Bridge - -Bridge + +Bridge Domain - -Domain + +Domain Bridge->Domain - - -13 + + +13 - + -Support - -Support +Infrastructure + +Infrastructure - + -Bridge->Support - - -1 +Bridge->Infrastructure + + +1 DatabaseFactories - -DatabaseFactories + +DatabaseFactories DatabaseFactories->Domain - - -4 + + +4 DatabaseSeeders - -DatabaseSeeders + +DatabaseSeeders DatabaseSeeders->DatabaseFactories - - -4 + + +4 diff --git a/README.md b/README.md index db916bbd..da874867 100644 --- a/README.md +++ b/README.md @@ -225,6 +225,28 @@ Check full instructions in [docker-shared-services](https://github.com/wayofdev/
+## 🧰 Project Architecture + +The project architecture of `wayofdev/laravel-starter-tpl` follows a structured approach with distinct layers: + +* **Domain:** Contains core business logic and entities. +* **Bridge:** Connects the domain layer with external systems or services. +* **Infrastructure:** Handles interactions with external systems, such as databases, APIs, or file systems. +* **Support:** Provides general-purpose helper classes that assist various parts of the application. +* **DatabaseSeeders:** Handles database seeding logic. +* **DatabaseFactories:** Manages database factory definitions. +* **Tests:** Contains test cases for various layers of the application. + +Each layer has defined dependencies, ensuring a clear separation of concerns and facilitating maintainability and scalability. + +For more information check [deptrac.yaml](https://github.com/wayofdev/laravel-starter-tpl/blob/develop/app/deptrac.yaml) located in repository `app` folder. + +### → Architecture Diagram + +![Architecture Diagram](.github/assets/deptrac.svg) + +
+ ## 🤖 Deployment to Staging and Production This repository utilizes GitHub Actions for continuous deployment to both staging and production servers. Below is a description. diff --git a/app/composer.json b/app/composer.json index da64aedd..bb24969d 100644 --- a/app/composer.json +++ b/app/composer.json @@ -75,6 +75,7 @@ "Database\\Factories\\": "database/factories/", "Database\\Seeders\\": "database/seeders/", "Domain\\": "src/Domain/", + "Infrastructure\\": "src/Infrastructure/", "Support\\": "src/Support/" } }, diff --git a/app/deptrac.yaml b/app/deptrac.yaml index 573d606d..6e50be54 100644 --- a/app/deptrac.yaml +++ b/app/deptrac.yaml @@ -21,6 +21,11 @@ deptrac: - type: directory value: src/Bridge/.* + - name: Infrastructure + collectors: + - type: directory + value: src/Infrastructure/.* + - name: Support collectors: - type: directory @@ -45,9 +50,12 @@ deptrac: Domain: ~ Bridge: - Domain + - Infrastructure - Support - Support: + Infrastructure: - Domain + - Support + Support: DatabaseSeeders: - DatabaseFactories - Domain @@ -56,6 +64,7 @@ deptrac: Tests: - Domain - Bridge + - Infrastructure - Support - DatabaseSeeders - DatabaseFactories diff --git a/app/psalm-baseline.xml b/app/psalm-baseline.xml index 5530d2c3..8215121c 100644 --- a/app/psalm-baseline.xml +++ b/app/psalm-baseline.xml @@ -196,7 +196,7 @@ - + @@ -250,4 +250,9 @@ + + + + + diff --git a/app/src/Bridge/Laravel/Public/Category/Queries/IndexQuery.php b/app/src/Bridge/Laravel/Public/Category/Queries/IndexQuery.php index 09eea2bf..87806773 100644 --- a/app/src/Bridge/Laravel/Public/Category/Queries/IndexQuery.php +++ b/app/src/Bridge/Laravel/Public/Category/Queries/IndexQuery.php @@ -6,9 +6,9 @@ use Domain\Category\Models\Category; use Illuminate\Http\Request; +use Infrastructure\Filters\FuzzyFilter; use Spatie\QueryBuilder\AllowedFilter; use Spatie\QueryBuilder\QueryBuilder; -use Support\Filters\FuzzyFilter; final class IndexQuery extends QueryBuilder { diff --git a/app/src/Support/Filters/FuzzyFilter.php b/app/src/Infrastructure/Filters/FuzzyFilter.php similarity index 96% rename from app/src/Support/Filters/FuzzyFilter.php rename to app/src/Infrastructure/Filters/FuzzyFilter.php index 1aa1dcfe..4b785f10 100644 --- a/app/src/Support/Filters/FuzzyFilter.php +++ b/app/src/Infrastructure/Filters/FuzzyFilter.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Support\Filters; +namespace Infrastructure\Filters; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; diff --git a/app/src/Support/StringUtils.php b/app/src/Support/StringUtils.php new file mode 100644 index 00000000..01428605 --- /dev/null +++ b/app/src/Support/StringUtils.php @@ -0,0 +1,16 @@ +