Skip to content

Commit 65047bf

Browse files
authored
Merge pull request #420 from wayofdev/fix/infection
2 parents fd544d7 + 3a90d44 commit 65047bf

File tree

10 files changed

+109
-33
lines changed

10 files changed

+109
-33
lines changed

.github/assets/deptrac.svg

Lines changed: 29 additions & 29 deletions
Loading

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,28 @@ Check full instructions in [docker-shared-services](https://github.com/wayofdev/
225225

226226
<br>
227227

228+
## 🧰 Project Architecture
229+
230+
The project architecture of `wayofdev/laravel-starter-tpl` follows a structured approach with distinct layers:
231+
232+
* **Domain:** Contains core business logic and entities.
233+
* **Bridge:** Connects the domain layer with external systems or services.
234+
* **Infrastructure:** Handles interactions with external systems, such as databases, APIs, or file systems.
235+
* **Support:** Provides general-purpose helper classes that assist various parts of the application.
236+
* **DatabaseSeeders:** Handles database seeding logic.
237+
* **DatabaseFactories:** Manages database factory definitions.
238+
* **Tests:** Contains test cases for various layers of the application.
239+
240+
Each layer has defined dependencies, ensuring a clear separation of concerns and facilitating maintainability and scalability.
241+
242+
For more information check [deptrac.yaml](https://github.com/wayofdev/laravel-starter-tpl/blob/develop/app/deptrac.yaml) located in repository `app` folder.
243+
244+
### → Architecture Diagram
245+
246+
![Architecture Diagram](.github/assets/deptrac.svg)
247+
248+
<br>
249+
228250
## 🤖 Deployment to Staging and Production
229251

230252
This repository utilizes GitHub Actions for continuous deployment to both staging and production servers. Below is a description.

app/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
"Database\\Factories\\": "database/factories/",
7676
"Database\\Seeders\\": "database/seeders/",
7777
"Domain\\": "src/Domain/",
78+
"Infrastructure\\": "src/Infrastructure/",
7879
"Support\\": "src/Support/"
7980
}
8081
},

app/deptrac.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ deptrac:
2121
- type: directory
2222
value: src/Bridge/.*
2323

24+
- name: Infrastructure
25+
collectors:
26+
- type: directory
27+
value: src/Infrastructure/.*
28+
2429
- name: Support
2530
collectors:
2631
- type: directory
@@ -45,9 +50,12 @@ deptrac:
4550
Domain: ~
4651
Bridge:
4752
- Domain
53+
- Infrastructure
4854
- Support
49-
Support:
55+
Infrastructure:
5056
- Domain
57+
- Support
58+
Support:
5159
DatabaseSeeders:
5260
- DatabaseFactories
5361
- Domain
@@ -56,6 +64,7 @@ deptrac:
5664
Tests:
5765
- Domain
5866
- Bridge
67+
- Infrastructure
5968
- Support
6069
- DatabaseSeeders
6170
- DatabaseFactories

app/psalm-baseline.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@
196196
<code><![CDATA[$hidden]]></code>
197197
</NonInvariantDocblockPropertyType>
198198
</file>
199-
<file src="src/Support/Filters/FuzzyFilter.php">
199+
<file src="src/Infrastructure/Filters/FuzzyFilter.php">
200200
<MixedAssignment>
201201
<code><![CDATA[$item]]></code>
202202
</MixedAssignment>
@@ -250,4 +250,9 @@
250250
<code><![CDATA[make]]></code>
251251
</MixedMethodCall>
252252
</file>
253+
<file src="tests/src/Functional/Support/StringUtilsTest.php">
254+
<PossiblyUnusedMethod>
255+
<code><![CDATA[it_converts_string]]></code>
256+
</PossiblyUnusedMethod>
257+
</file>
253258
</files>

app/src/Bridge/Laravel/Public/Category/Queries/IndexQuery.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
use Domain\Category\Models\Category;
88
use Illuminate\Http\Request;
9+
use Infrastructure\Filters\FuzzyFilter;
910
use Spatie\QueryBuilder\AllowedFilter;
1011
use Spatie\QueryBuilder\QueryBuilder;
11-
use Support\Filters\FuzzyFilter;
1212

1313
final class IndexQuery extends QueryBuilder
1414
{

app/src/Support/Filters/FuzzyFilter.php renamed to app/src/Infrastructure/Filters/FuzzyFilter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace Support\Filters;
5+
namespace Infrastructure\Filters;
66

77
use Illuminate\Database\Eloquent\Builder;
88
use Illuminate\Database\Eloquent\Model;

app/src/Support/StringUtils.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Support;
6+
7+
/**
8+
* This is a stub class, just to show purpose of Support layer.
9+
*/
10+
final class StringUtils
11+
{
12+
public static function toTitleCase(string $str): string
13+
{
14+
return ucwords(strtolower($str));
15+
}
16+
}

app/tests/src/Functional/Support/.gitkeep

Whitespace-only changes.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Tests\Functional\Support;
6+
7+
use PHPUnit\Framework\Attributes\Test;
8+
use PHPUnit\Framework\TestCase;
9+
use Support\StringUtils;
10+
11+
class StringUtilsTest extends TestCase
12+
{
13+
#[Test]
14+
public function it_converts_string(): void
15+
{
16+
$input = 'hello world';
17+
$expectedOutput = 'Hello World';
18+
19+
$actualOutput = StringUtils::toTitleCase($input);
20+
21+
self::assertSame($expectedOutput, $actualOutput);
22+
}
23+
}

0 commit comments

Comments
 (0)