Skip to content

Instantly share code, notes, and snippets.

@satooshi
Last active September 26, 2021 20:03
Show Gist options
  • Star 46 You must be signed in to star a gist
  • Fork 11 You must be signed in to fork a gist
  • Save satooshi/6396551 to your computer and use it in GitHub Desktop.
Save satooshi/6396551 to your computer and use it in GitHub Desktop.
Directory structure of Domain Driven Design application with Symfony2, Doctrine2.
sf2-ddd
├── app
├── bin
├── build
├── lib
├── src
│   └── __VendorPrefix
│   ├── Application
│   │   └── __DomainNameBundle
│   │   ├── Command
│   │   │   └── __Command.php
│   │   ├── Controller
│   │   │   └── __Controller.php
│   │   ├── DependencyInjection
│   │   │   ├── Configuration.php
│   │   │   ├── __CompilerPass.php
│   │   │   └── __Extension.php
│   │   ├── Form
│   │   │   ├── Extension
│   │   │   │   └── __FormExtension.php
│   │   │   ├── Model
│   │   │   │   └── __FormDataModel.php
│   │   │   └── Type
│   │   │   └── __EntityType.php
│   │   ├── Page
│   │   │   └── __Page.php
│   │   ├── Resources
│   │   │   ├── config
│   │   │   │   ├── routing.yml
│   │   │   │   └── services.yml
│   │   │   ├── translations
│   │   │   └── views
│   │   ├── Tests
│   │   │   ├── Command
│   │   │   │   └── __CommandTestCases
│   │   │   ├── Controller
│   │   │   │   └── __ControllerTestCases
│   │   │   ├── DependencyInjection
│   │   │   │   └── __DependencyInjectionTestCases
│   │   │   ├── Form
│   │   │   │   └── __FormTestCases
│   │   │   └── Page
│   │   │   └── __PageTestCases
│   │   └── __DomainNameAppBundle.php
│   ├── Component
│   ├── Domain
│   │   ├── Shared
│   │   │   └── Value
│   │   │   ├── Gender.php
│   │   │   └── Interval.php
│   │   └── __DomainNameBundle
│   │   ├── Application
│   │   │   └── __ApplicationService.php
│   │   ├── Entity
│   │   │   ├── Model
│   │   │   │   └── __EntityDataModel.php
│   │   │   └── __EntityExtendsDataModel.php
│   │   ├── Event
│   │   │   └── __DomainEvent.php
│   │   ├── Exception
│   │   │   └── __DomainException.php
│   │   ├── Interface
│   │   │   ├── Dto
│   │   │   │   └── __ServiceDto.php
│   │   │   └── Facade
│   │   │   └── __ServiceFacade.php
│   │   ├── Listener
│   │   │   ├── __DomainEventListener.php
│   │   │   └── __EntityListener.php
│   │   ├── Repository
│   │   │   └── __EntityRepositoryInterface.php
│   │   ├── Resources
│   │   │   └── config
│   │   │   ├── doctrine
│   │   │   │   ├── __Document.mongodb.xml
│   │   │   │   └── __Entity.orm.xml
│   │   │   ├── services.yml
│   │   │   └── validation.yml
│   │   ├── Service
│   │   │   └── __DomainService.php
│   │   ├── Specification
│   │   │   └── __DomainSpecification.php
│   │   ├── Tests
│   │   │   ├── Application
│   │   │   │   └── __ApplicationServiceTestCases
│   │   │   ├── Entity
│   │   │   │   └── __EntityTestCases
│   │   │   ├── Event
│   │   │   │   └── __EventTestCases
│   │   │   ├── Exception
│   │   │   │   └── __ExceptionTestCases
│   │   │   ├── Interface
│   │   │   │   └── __InterfaceTestCases
│   │   │   ├── Listener
│   │   │   │   └── __ListenerTestCaess
│   │   │   ├── Service
│   │   │   │   └── __ServiceTestCases
│   │   │   ├── Specification
│   │   │   │   └── __SpecificationTestCases
│   │   │   └── Validator
│   │   │   └── __ValidatorTestCases
│   │   ├── Validator
│   │   │   └── __DomainValidator.php
│   │   └── __DomainNameBundle.php
│   └── Infrastructure
│   └── __DomainNameBundle
│   ├── Messaging
│   │   ├── __EmailConsumer.php
│   │   └── __LoggingConsumer.php
│   ├── Repository
│   │   ├── __DocumentRepository.php
│   │   └── __EntityRepository.php
│   ├── Tests
│   │   ├── Messaging
│   │   │   └── __MessagingTestCases
│   │   └── Repository
│   │   └── __RepositoryTestCases
│   └── __DomainNameBundle.php
├── tests
│   └── SeleniumTestSuite
├── vendor
└── web
@pablomoreno61
Copy link

Hi,

Nice directory structure :-). I have some questions, where do you place your use cases? Why application services are placed under domain folder? Do you have any coded project to see this structure in practice?

many thanks in advance!

@nvjkmr
Copy link

nvjkmr commented Aug 30, 2019

Where would you place the aggregates?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment