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(3y ago)3310.0k↑10.7%4[1 PRs](https://github.com/xmolecules/phpmolecules/pulls)1Apache-2.0PHPPHP &gt;=8.0

Since May 11Pushed 2y 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 1mo ago

READMEChangelogDependencies (3)Versions (3)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

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity36

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 83.3% 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

1448d 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 (35 commits)")[![shochdoerfer](https://avatars.githubusercontent.com/u/596449?v=4)](https://github.com/shochdoerfer "shochdoerfer (6 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

[prodigyview/prodigyview

Complete PHP Toolkit

648.2k](/packages/prodigyview-prodigyview)[pingpong/oembed

Laravel 4 - Retrieve page info using oembed, opengraph, etc.

142.1k](/packages/pingpong-oembed)

PHPackages © 2026

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