thetis20 / notification-domain
domain of notification application
Installs: 3
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/thetis20/notification-domain
Requires
- php: >=8.3.12
- ext-ctype: *
- ext-iconv: *
- beberlei/assert: ^3.3
- phpdocumentor/reflection-docblock: ^5.4
- phpstan/phpdoc-parser: ^1.33
- symfony/dotenv: ^7.1
- symfony/uid: ^7.1
Requires (Dev)
- phpstan/phpstan: ^2.0
- phpunit/phpunit: ^9.5
README
Context
This project is an application designed to explore concepts such as Clean Architecture, Test-Driven Development (TDD), Domain-Driven Design (DDD), and Hexagonal Architecture. These approaches aim to produce maintainable, scalable, and testable code.
Technologies
- PHP : Programming language used for business logic.
- Composer : Dependency manager for PHP.
- PHPUnit : Tool for unit testing.
- Docker : Containerization platform to simplify application execution and isolation.
Key Concepts
1. Clean Architecture
Clean Architecture is a set of principles designed to organize code in a way that it is independent of frameworks, databases, and user interfaces. It enables:
- Separation of concerns.
- Easier testing.
- More comprehensible and maintainable code.
2. Test-Driven Development (TDD)
TDD is a development methodology based on writing tests before coding the functionality. The process follows three steps:
- Write a test that fails.
- Write the minimum code necessary to make the test pass.
- Refactor the code while ensuring the tests still pass.
TDD improves code quality and reduces the number of bugs.
3. Domain-Driven Design (DDD)
DDD is a software design approach focusing on the business domain. It encourages collaboration between developers and domain experts to:
- Model the domain effectively.
- Use a common language.
- Structure code around business concepts.
4. Hexagonal Architecture
Hexagonal Architecture, or Ports and Adapters Architecture, separates the core application logic from external interactions (UI, databases, APIs, etc.). It allows:
- Easier testing of the application core.
- Replacement of external components without impacting business logic.
- Simplified application evolution.
Installation and Usage
This project composer
-
Clone the repository:
git clone git@github.com:thetis20/notification-domain.git cd notification-domain -
Install composer dependencies:
composer install
-
Run tests
composer run-script tests
Class Diagram
---
title: Notification Domain
---
classDiagram
class User {
-string id
-string usualName
-Email email
-?Phone phone
+getId(): string
+getUsualName(): string
+getEmail(): Email
+getPhone(): ?Phone
+jsonSerialize(): array<string,mixed>
}
class Notification {
-Uuid id
-array<User|Email|Phone> to
-string key
-DateTime date
-array<string,mixed> params
-int status
+getId(): Uuid
+getTo(): array<User|Email|Phone>
+getKey(): string
+getDate(): DateTime
+getParams(): array<string,mixed>
+getStatus(): int
+jsonSerialize(): array<string,mixed>
}
Loading
License
This project is licensed under the MIT License. Please refer to the LICENSE file for more information.