Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xmolecules/phpmolecules
Libraries to help developers express architectural abstractions in PHP code
https://github.com/xmolecules/phpmolecules
architecture domain-driven-design php
Last synced: 2 months ago
JSON representation
Libraries to help developers express architectural abstractions in PHP code
- Host: GitHub
- URL: https://github.com/xmolecules/phpmolecules
- Owner: xmolecules
- License: apache-2.0
- Created: 2021-03-18T11:56:07.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-10-26T14:50:59.000Z (about 1 year ago)
- Last Synced: 2024-11-06T10:53:34.394Z (3 months ago)
- Topics: architecture, domain-driven-design, php
- Language: PHP
- Homepage: https://xmolecules.org
- Size: 53.7 KB
- Stars: 28
- Watchers: 7
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# phpMolecules – Architectural Abstractions for PHP
A set of libraries to help developers work with architectural concepts in PHP.
Member of the xMolecules family.
Goals:* Express that a piece of code (namespace, class, method...) implements an architectural concept.
* Make it easy for the human reader to determine what kind of architectural concepts a given piece of code is.
* Allow tool integration (to do interesting stuff like generating persistence or static architecture analysis to check for validations of the architectural rules.)## Expressing DDD Concepts
Example:
```php
use PHPMolecules\DDD\Attribute\{Entity, ValueObject, Repository};#[Entity]
class BankAccount { /* ... */ }#[ValueObject]
class Currency { /* ... */ }#[Repository]
class Accounts { /* ... */ }
```When we take Ubiquitous Language serious, we want names (for classes, methods, etc.) that only contain words from the domain language.
That means the titles of the building blocks should not be part of the names.
So in a banking domain we don't want `BankAccountEntity`, `CurrencyVO` or even `AccountRepository` as types.
Instead, we want `BankAccount`, `Currency` and `Accounts` – like in the example above.Still, we want to express that a given class (or other architectural element) is a special building block; i.e. uses a design pattern.
PHPMolecules provide a set of standard annotations for the building blocks known from DDD.## Expressing Architecture
phpMolecules provides annotations to mark a package as a layer (or ring):
TODO: port documentation from jMolecules.
## Installation
To use phpMolecules in your project just install it with Composer from Packagist:
```fish
composer require xmolecules/phpmolecules
```## Release Instructions
Create a new Git version tag and push it:
```fish
git tag --sign vX.Y.Z
git push --tags
```