Domain-Driven Design in YII

Hello Yiiers,

Recently I came to know about a methodology called Domain Driven Design. I am still learning about it. My immediate reaction was to check if YII supports such design.

To my surprise google showed me another framework called Flow3 which is developed in PHP and implements the DDD design.

I want the guys to discuss more about it and help me find a solution for implementing DDD design in YII as I dont want to learn another framework and I love YII. Attached link expains the DDD design from the FLOW3 documentation

DDD and Flow3 Framework

Fortunately you don’t have to. Domain Driven Design is not a “feature” that can be implemented at framework level. The reason for that is simple: the framework doesn’t know anything (and must not make too much assumptions) about the actual problem domain of your client/employer. Problem domain analysis and application design is your responsibility and you are free to use any methodology you wish. Yii only provides tools for the implementation phase.

Hi Malkum, I don’t use Domain Driven Design (DDD) yet, but I completely read the Evans book (the DDD creator) and other DDD papers. I agree with phtamas that Yii is agnostic regarding the design process you use (like most programming frameworks). However, I think that is very difficult implement a DDD design with a language/framework that is not strongly object oriented. Happily, Yii it is, much more than pure PHP, which supports object oriented programming but is not object oriented itself. This is the reason because most DDD designers prefer Java as their programming language. But you can use Yii with DDD. Just my opinion.

Best regards,


As far as i know Yii was designed to develop application by using database first approach, and basically DDD drived from model, so i think if we want to implement the DDD methodology using Yii then Yii must provide some support to model first development rather than generate model from existing database tables. I really interested to know such design model to be supported by Yii,

I always us a model first approach - always.

I rely on migrations so I don’t need any existing database tables.

may you write some tutorial of using migration for DDD? I’ll really appreciate this,