Skip to content

Instantly share code, notes, and snippets.

@dimabory
Last active February 4, 2019 08:31
Show Gist options
  • Save dimabory/8f8abbcfc1042e3c6307b4255ba96f81 to your computer and use it in GitHub Desktop.
Save dimabory/8f8abbcfc1042e3c6307b4255ba96f81 to your computer and use it in GitHub Desktop.
ddd-style project structure (WIP)
  1. Think about Shared Kernel (http://ddd.fed.wiki.org/view/welcome-visitors/view/domain-driven-design/view/shared-kernel)
src/
    Infrastructure/
        Auth/                                   
            ...                                 // e.g. Symfony/ (acl, voters) 
        Framework/
            ...                                 // e.g. Symfony kernel or Zend Expressive
        Persistence/
            Doctrine/
                ...                             // types, create factory, etc.
            InMemory/
                ...
            <KV>/                               // e.g. Redis
                ...
        Bus/
            ...                                 // command, event buses
        ...
    Core/
        Profile/
            Domain/
                Account                             // aggregate
                AccountRepository                   // interface                
                AccountCreated                      // domain event
                ...                                 // entities, vo, factories, exceptions ...
            Application/
                Create/            
                    CreateAccountCommand
                    CreateAccountCommandHandler
                Query/
                    FindAccountQuery                // or FindAccount
                Persistence/
                    DQL/                            // or Doctrine
                        AccountRepositoryDoctrine   // or AccountRepositoryMySQL
                        ...                         // orm mappings, etc
                ...
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            Infrastructure/                         // still not sure if it's even needed here
                Http/
                    CreateAccountAction             // __invoke
                    ...
                Console/
                    CreateAccount
                ...
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        <BoundedContext>/
             ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment