damianopetrungaro / clean-architecture

Package for isolate your domain code from framework dependency using DDD concepts.
MIT License
96 stars 20 forks source link
clean-architecture ddd domain-driven-design php

clean-architecture

Code Climate Build Status

Package for isolate your domain code from framework dependency

What are Domain,Application and Infrastructure layer? Click here for a resume.

Why?

Why did you code this package?

When I code, I usually isolate the Domain layer from Application layer and Infrastructure layer, and every time I do it I need to re-build a set of objects that helps me doing this.

Those objects often are a Request, a Response and some Errors.

This package is born for me, to avoid re-building such set of objects, also avoiding some copy/paste from different projects.

Why should you isolate your domain code from Application and Infrastructure dependencies?

Imagine that your PHP application is currently built on top of Laravel framework.

And use a modern frameworks (such Laravel, Symfony or Slim) is a very good thing. Helps you to write a better code without reinvent the wheel.

But what if you want/must switch your current framework for performance, architectural or other reasons to an another one?

Usually this is very painful, and you are despondent to change it. This choose bind you to a tool that might not be as good as before for your project.

And this is only an example. There can be a lot of more reasons why you want to change framework.

How can I isolate it?

Using some DDD concepts, you can totally (or almost) isolate your domain code from the Application layer (Laravel for example) and from the Infrastructure layer (Postgresql or Mysql for example).

So the Domain of my application is not relegated to a particular framework/package/database, and can be "easily" switched.

What hepls me to realize this package?

There are some books that helped me to "think" in this way. Here some of them:

Clean PHP

DDD in PHP

DDD by Evans

A Minimal Documentation

A Practical Example

Changelog

[0.4] 2018-06-01