Skip to content

Instantly share code, notes, and snippets.

@mxr576
Created May 23, 2021 13:31
Show Gist options
  • Save mxr576/352d30126a123a33ec7e8ef51dc96ecf to your computer and use it in GitHub Desktop.
Save mxr576/352d30126a123a33ec7e8ef51dc96ecf to your computer and use it in GitHub Desktop.
Code organization example of an onion-based Symfony app
// source: https://blog.itsjavi.com/target-software-architectures-the-onion-architecture
/tests
/src
    /Application
        /UseCase
            /CreateOrder
                CreateOrderRequest
                CreateOrderResponse
                CreateOrderUseCase
    /DomainModel
        /Orders
            /Service
                OrderCodeGenerator
                OrderStateManager
            /Factory
                OrderFactory
            /Entity
                OrderEntity
            /Event
                OrderCreatedEvent
            /Repository
                OrderRepositoryInterface
    /Presentation
        /Http
            /Authentication
            /Transformer
                RequestDataTransformer
                ExceptionTransformer
                ResponseFactory
            /EventSubscriber
                ExceptionSubscriber
            /Controller
                CreateOrderController
        /Cli
            /Command
                CreateOrderCommand
        /Mq
            /MessageProducer
                OrderCreatedMessageProducer
            /MessageConsumer
                ExternalPaymentMessageConsumer
    /Infrastructure
        /Repository
            /Mysql
                OrderRepository
        /PaymentProvider
            /PaymentProviderClient
        /FileStorage
            /FileSystemClient
            /S3Client
    /Support
        TokenGenerator
        DateFormatter
        /VendorLibrary
            /MyVendorLibraryExtension
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment