PHPackages                             rossaddison/ddd-template - 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. [Templating &amp; Views](/categories/templating)
4. /
5. rossaddison/ddd-template

ActiveProject[Templating &amp; Views](/categories/templating)

rossaddison/ddd-template
========================

A lean Yii3 starter with working auth + 2FA + RBAC, and a real Domain/Application/Infrastructure/Shell DDD layering example (Settings + Telegram bot connectivity) to build your own modules on top of.

v0.1.0(today)00BSD-3-ClausePHPPHP 8.3 - 8.5CI passing

Since Jul 27Pushed todayCompare

[ Source](https://github.com/rossaddison/ddd-template)[ Packagist](https://packagist.org/packages/rossaddison/ddd-template)[ Docs](https://github.com/rossaddison/ddd-template)[ RSS](/packages/rossaddison-ddd-template/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (95)Versions (2)Used By (0)

[![Yii3](https://camo.githubusercontent.com/d6b0929173e28cc627430d2519ca1853466a70f37395877eaf4820cb3e1e1909/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f506f77657265645f62792d5969695f4672616d65776f726b2d677265656e2e7376673f7374796c653d666c6174)](https://www.yiiframework.com/)[![Latest Version](https://camo.githubusercontent.com/d0164784cd567ea73a7f469dd01ddd90e4fb51dd1eca1c5fc88a121a4ed4402c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f726f737361646469736f6e2f6464642d74656d706c6174652e7376673f7374796c653d666c6174)](https://packagist.org/packages/rossaddison/ddd-template)[![Total Downloads](https://camo.githubusercontent.com/113a6dcb9c2a58edd0deb23a8eefbb1a4c809164ef602bd49c7e567e39148509/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f726f737361646469736f6e2f6464642d74656d706c6174652e7376673f7374796c653d666c6174)](https://packagist.org/packages/rossaddison/ddd-template)[![PHP Version](https://camo.githubusercontent.com/b0966cf72298bce4cdaea0e19a2b71a4bc35c08e678bbb7cab1392386d407398/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f726f737361646469736f6e2f6464642d74656d706c6174652e7376673f7374796c653d666c6174)](https://packagist.org/packages/rossaddison/ddd-template)[![License](https://camo.githubusercontent.com/08cef40a9105b6526ca22088bc514fbfdbc9aac1ddbf8d4e6c750e3a88a44dca/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d626c75652e737667)](https://opensource.org/licenses/MIT)

ddd-template
============

[](#ddd-template)

A lean [Yii3](https://www.yiiframework.com/) starter, extracted from [`rossaddison/invoice`](https://github.com/rossaddison/invoice), meant to be built on top of — not another invoicing app.

It carries over only the reusable skeleton:

- Auth (login/signup/password reset) with 2FA (Aegis/TOTP-compatible) and RBAC.
- OAuth social login (`yiisoft/yii-auth-client`) — Facebook, GitHub, Google, LinkedIn, Microsoft, VKontakte, X, Yandex.
- A bare nav-menu Shell (no domain-specific frills).

...plus one fully worked example of the layering pattern this repo is actually here to demonstrate — a real **Domain / Application / Infrastructure / Shell** DDD split (contrasted with the anemic Cycle-ORM-entity-as-domain-model pattern most of the invoice app itself uses):

- `src/Domain/{Setting,Telegram}` — pure PHP entities, value objects, repository/gateway interfaces. No framework dependency.
- `src/Application/{Setting,Telegram}` — use-case classes (`__invoke`), orchestrating Domain interfaces.
- `src/Infrastructure/Persistence/{Setting,Telegram}`, `src/Infrastructure/Telegram` — Cycle ORM + Telegram Bot API implementations of those interfaces.
- `src/Shell` — the HTTP/presentation layer: `BaseController`, RBAC permissions, view injections, controllers, views.

Settings admin and Telegram bot connectivity (token/webhook/chat-id/test message) are the worked example — copy the same four-layer shape when adding your own module.

Status
------

[](#status)

Runnable end-to-end and live-verified: signup → login → mandatory 2FA setup → 2FA verify → Shell → logout, all exercised against a real local MySQL database. See [`docs/PROGRESS.md`](docs/PROGRESS.md) for exactly what was tested, the deliberate simplifications made versus invoice's own Auth flow (no email-verification gate, no HMRC/GovUk/OpenBanking), and what's still out of scope (live OAuth provider callbacks, a real Telegram bot).

Requirements
------------

[](#requirements)

- PHP 8.3 – 8.5
- MySQL (or another Cycle ORM–supported database)
- Composer

Getting started
---------------

[](#getting-started)

```
composer install
cp .env.example .env
# fill in DB_*, COOKIE_SECRET_KEY, and any OAuth provider credentials you want
```

Database schema is entity-driven (Cycle ORM), not migration-file-driven: set `BUILD_DATABASE=true` in `.env`, hit the app once to sync tables, then set it back to `false`.

```
php yii serve
```

Quality
-------

[](#quality)

```
vendor/bin/psalm --no-cache   # errorLevel=1, findUnusedCode=true — clean
vendor/bin/testo --suite=Unit # 22/22 passing
```

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance100

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

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

0d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/79f16141a5b619c098d6bec3812cd770dfc9b48eacc093f4ef88fbf20e735ec1?d=identicon)[yii2house2house](/maintainers/yii2house2house)

---

Top Contributors

[![rossaddison](https://avatars.githubusercontent.com/u/8538339?v=4)](https://github.com/rossaddison "rossaddison (8 commits)")

---

Tags

templateyiiDomain Driven Designddd

###  Code Quality

Static AnalysisPsalm, Rector

Type Coverage Yes

### Embed Badge

![Health badge](/badges/rossaddison-ddd-template/health.svg)

```
[![Health](https://phpackages.com/badges/rossaddison-ddd-template/health.svg)](https://phpackages.com/packages/rossaddison-ddd-template)
```

###  Alternatives

[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k16](/packages/tempest-framework)[yiisoft/app

Yii3 web application template

37214.4k](/packages/yiisoft-app)[laravel/framework

The Laravel Framework.

34.8k543.8M20.6k](/packages/laravel-framework)[yiisoft/app-api

Yii3 API project template

1041.8k](/packages/yiisoft-app-api)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M605](/packages/shopware-core)[typo3/cms

TYPO3 CMS is a free open source Content Management Framework initially created by Kasper Skaarhoj and licensed under GNU/GPL.

1.2k1.9M122](/packages/typo3-cms)

PHPackages © 2026

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