PHPackages                             xmolecules/phpmolecules - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. xmolecules/phpmolecules

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

xmolecules/phpmolecules
=======================

Libraries to help developers express architectural abstractions in PHP code

v0.2.0(4y ago)3311.9k↑32.4%4[1 issues](https://github.com/xmolecules/phpmolecules/issues)[2 PRs](https://github.com/xmolecules/phpmolecules/pulls)1Apache-2.0PHPPHP &gt;=8.0CI passing

Since May 11Pushed 2w ago6 watchersCompare

[ Source](https://github.com/xmolecules/phpmolecules)[ Packagist](https://packagist.org/packages/xmolecules/phpmolecules)[ Docs](https://xmolecules.org/)[ RSS](/packages/xmolecules-phpmolecules/feed)WikiDiscussions main Synced 2d ago

READMEChangelogDependencies (3)Versions (4)Used By (1)

phpMolecules – Architectural Abstractions for PHP
=================================================

[](#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
-----------------------

[](#expressing-ddd-concepts)

Example:

```
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
-----------------------

[](#expressing-architecture)

phpMolecules provides annotations to mark a package as a layer (or ring):

TODO: port documentation from jMolecules.

Installation
------------

[](#installation)

To use phpMolecules in your project just install it with Composer from Packagist:

```
composer require xmolecules/phpmolecules
```

Release Instructions
--------------------

[](#release-instructions)

Create a new Git version tag and push it:

```
git tag --sign vX.Y.Z
git push --tags
```

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance63

Regular maintenance activity

Popularity37

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 83% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~385 days

Total

2

Last Release

1494d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c480c2567be1168af165f9294b437a6ebe100a1db2e8fae49225f1b0ea7b104c?d=identicon)[hschwentner](/maintainers/hschwentner)

---

Top Contributors

[![hschwentner](https://avatars.githubusercontent.com/u/12659785?v=4)](https://github.com/hschwentner "hschwentner (39 commits)")[![shochdoerfer](https://avatars.githubusercontent.com/u/596449?v=4)](https://github.com/shochdoerfer "shochdoerfer (6 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![odrotbohm](https://avatars.githubusercontent.com/u/128577?v=4)](https://github.com/odrotbohm "odrotbohm (1 commits)")

---

Tags

architecturedomain-driven-designphp

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/xmolecules-phpmolecules/health.svg)

```
[![Health](https://phpackages.com/badges/xmolecules-phpmolecules/health.svg)](https://phpackages.com/packages/xmolecules-phpmolecules)
```

###  Alternatives

[php-decimal/php-decimal

Correctly-rounded arbitrary precision decimal floating point

781.1M10](/packages/php-decimal-php-decimal)[binarycabin/laravel-uuid

A wrapper for webpatser/laravel-uuid with additional integration

86625.6k](/packages/binarycabin-laravel-uuid)[brotkrueml/schema

Embedding schema.org vocabulary - API and view helpers for schema.org markup

34653.7k16](/packages/brotkrueml-schema)[mrsuh/php-var-sizeof

Provides functions for getting full size of any PHP variable

6010.4k](/packages/mrsuh-php-var-sizeof)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
