PHPackages                             mbrowne/dci - 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. mbrowne/dci

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

mbrowne/dci
===========

Implementation of the DCI architecture in PHP using traits

1.0.0(6y ago)1484MITPHPPHP ^5.5 || ^7.0

Since Jun 26Pushed 1y ago6 watchersCompare

[ Source](https://github.com/mbrowne/dci-php)[ Packagist](https://packagist.org/packages/mbrowne/dci)[ Docs](https://github.com/mbrowne/dci-php)[ RSS](/packages/mbrowne-dci/feed)WikiDiscussions master Synced 4d ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

dci-php
=======

[](#dci-php)

A PHP implementation of the DCI (Data, Context, and Interaction) programming paradigm.

The best place to start is probably the examples folder. Additional documentation for this library is not yet available (other than comments in the code), but in the meantime, for an introduction to DCI, see the article:

"Working with objects - in computer and mind" at .

Another very good (albeit somewhat older) introductory article is: [http://www.artima.com/articles/dci\_vision.html](http://www.artima.com/articles/dci_vision.html)

For more articles and information about DCI, see:

And this book by DCI's co-creator, which has a chapter on DCI: Lean Architecture: for Agile Software Development James O. Coplien and Gertrud Bjørnvig

You can also contact Matt Browne, the author of this library, at mbrowne83 \[at\] gmail \[dot\] com.

Note on object identity
-----------------------

[](#note-on-object-identity)

This library preserves object identity when adding roles to objects, as proven by the successful implementation of the DCI [Dijkstra example](examples/Dijkstra/), which was designed to showcase and test how object identity needs to work to implement DCI (see  for the Dijkstra example in other languages).

But there is one "gotcha" to be aware of: within role methods, `$this` does not have the same identity as the role-playing object, and is technically a wrapper object. The wrapper is needed in PHP because otherwise, it would not be possible to refer back to the context object, which the wrapper makes available as `$this->context`. (`$this->context` is necessary in order for roles to be able to reference and use the other roles in the context.) There are two ways around this object identity problem:

1. Completely avoid using `$this` when calling other methods of the current role, and always refer to the role by its name, e.g. for a role `MyRole`, instead of calling `$this->someRoleMethod()`, we could call `$this->context->MyRole->someRoleMethod()`.
2. (The more concise option) Use `$this->self` if you need a reference to the role-playing object itself. See the `CurrentNode` and `NeighborNode` roles in the [Dijkstra context](examples/Dijkstra/CalculateShortestPath.php) for an example of this.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

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

Unknown

Total

1

Last Release

2516d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1b9dfa5c813211a75b715e307de4989b9d68362748843afe4580cab3d64540a0?d=identicon)[mharrisonb](/maintainers/mharrisonb)

---

Top Contributors

[![mbrowne](https://avatars.githubusercontent.com/u/874316?v=4)](https://github.com/mbrowne "mbrowne (17 commits)")[![keithy](https://avatars.githubusercontent.com/u/193501?v=4)](https://github.com/keithy "keithy (2 commits)")

---

Tags

Contextrolesarchitecturedci

### Embed Badge

![Health badge](/badges/mbrowne-dci/health.svg)

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

###  Alternatives

[phpmentors/domain-kata

Kata for domain models

73426.9k9](/packages/phpmentors-domain-kata)[kartik-v/yii2-nav-x

An extended bootstrap Nav widget for Yii 2 with submenu drilldown.

27564.8k6](/packages/kartik-v-yii2-nav-x)

PHPackages © 2026

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