2017 © Pedro Pelรกez
 

project symfony-ddd-edition

A Symfony standard skeleton following DDD architecture.

image

regniblod/symfony-ddd-edition

A Symfony standard skeleton following DDD architecture.

  • Saturday, April 29, 2017
  • by regniblod
  • Repository
  • 6 Watchers
  • 70 Stars
  • 24 Installations
  • PHP
  • 0 Dependents
  • 1 Suggesters
  • 6 Forks
  • 1 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

ABANDONED - This repo won't be updated anymore

Symfony Standard DDD Edition

Welcome to the Symfony Standard DDD Edition - a fully-functional Symfony application with DDD architecture that you can use as the skeleton for your new applications., (*1)

For details on how to download and get started with Symfony, see the Installation chapter of the Symfony Documentation., (*2)

Installing the Symfony Standard DDD Edition

When it comes to installing the Symfony Standard DDD Edition, you have the following options., (*3)

As Symfony uses Composer to manage its dependencies, the recommended wayto create a new project is to use it., (*4)

If you don't have Composer yet, download it following the instructions on http://getcomposer.org/ or just run the following command:, (*5)

curl -s http://getcomposer.org/installer | php

Then, use the create-project command to generate a new Symfony application:, (*6)

php composer.phar create-project regniblod/symfony-ddd-edition --stability=dev path/to/install

Composer will install Symfony and all its dependencies under the path/to/install directory., (*7)

Download an Archive File

To quickly test Symfony, you can also download an archive of the Standard DDD Edition and unpack it somewhere under your web server root directory., (*8)

If you downloaded an archive "without vendors", you also need to install all the necessary dependencies. Download composer (see above) and run the following command:, (*9)

php composer.phar install

Checking your System Configuration

Before starting coding, make sure that your local system is properly configured for Symfony., (*10)

Execute the check.php script from the command line:, (*11)

php bin/symfony_requirements

Access the config.php script from a browser:, (*12)

http://localhost/path/to/symfony/config.php

If you get any warnings or recommendations, fix them before moving on., (*13)

Getting started with Symfony

This distribution is meant to be the starting point for your Symfony applications., (*14)

A great way to start learning Symfony is via the Quick Tour, which will take you through all the basic features of Symfony2., (*15)

Once you're feeling good, you can move onto reading the official Symfony2 book., (*16)

A default bundle, ModuleBundle, shows you Symfony DDD architecture in action. After playing with it, you can remove it by following these steps: * remove the routing entries referencing ModuleBundle in app/config/routing.yml. * remove the ModuleBundle from the registered bundles in app/AppKernel.php. * remove src/Project/Module and tests/Project/Module directories. * Remove all the .gitkeep files: find . -name .git -prune -o -type d -empty -exec touch {}/.gitkeep \;, (*17)

How to add a new module

Use the command symfony-ddd:generator:create-module <module_name> to create a new module with the complete src and tests directory structure, bundle, services and repositories files, routing and Doctrine mapping., (*18)

What's inside?

The Symfony Standard DDD Edition is configured with the following defaults: * A ModuleBundle you can use to start coding. * Twig as the only configured template engine. * Doctrine ORM/DBAL. * Swiftmailer. * Annotations enabled for everything., (*19)

It comes pre-configured with the following bundles: * FrameworkBundle - The core Symfony framework bundle * SensioFrameworkExtraBundle - Adds several enhancements, including template and routing annotation capability * DoctrineBundle - Adds support for the Doctrine ORM * TwigBundle - Adds support for the Twig templating engine * SecurityBundle - Adds security by integrating Symfony's security component * SwiftmailerBundle - Adds support for Swiftmailer, a library for sending emails * MonologBundle - Adds support for Monolog, a logging library * WebProfilerBundle (in dev/test env) - Adds profiling functionality and the web debug toolbar * SensioDistributionBundle (in dev/test env) - Adds functionality for configuring and working with Symfony distributions * [SensioGeneratorBundle][13] (in dev/test env) - Adds code generation capabilities * DebugBundle (in dev/test env) - Adds Debug and VarDumper component integration * [SymfonyDDDGeneratorBundle][13] (in dev/test env) - Adds code generation capabilities specifically for this Symfony distribution., (*20)

All libraries and bundles included in the Symfony Standard Edition are released under the MIT or BSD license., (*21)

Architecture

TODO: Explain different layers., (*22)

Folder structure

src
โ””โ”€โ”€ Project
    โ””โ”€โ”€ Module
        โ”œโ”€โ”€ Application
        โ”‚ย ย  โ””โ”€โ”€ ModuleBundle
        โ”‚ย ย      โ”œโ”€โ”€ Command
        โ”‚ย ย      โ”œโ”€โ”€ Controller
        โ”‚ย ย      โ”œโ”€โ”€ DependencyInjection
        โ”‚ย ย      โ”‚ย ย  โ””โ”€โ”€ Compiler
        โ”‚ย ย      โ””โ”€โ”€ Resources
        โ”‚ย ย          โ”œโ”€โ”€ config
        โ”‚ย ย          โ”‚ย ย  โ””โ”€โ”€ doctrine
        โ”‚ย ย          โ””โ”€โ”€ views
        โ”‚ย ย              โ””โ”€โ”€ default
        โ”œโ”€โ”€ Domain
        โ”‚ย ย  โ”œโ”€โ”€ Component
        โ”‚ย ย  โ”œโ”€โ”€ Event
        โ”‚ย ย  โ”œโ”€โ”€ Exception
        โ”‚ย ย  โ”œโ”€โ”€ Model
        โ”‚ย ย  โ”œโ”€โ”€ Repository
        โ”‚ย ย  โ”œโ”€โ”€ Service
        โ”‚ย ย  โ””โ”€โ”€ Value
        โ””โ”€โ”€ Infrastructure
            โ”œโ”€โ”€ Migrations
            โ”‚ย ย  โ””โ”€โ”€ Doctrine
            โ”œโ”€โ”€ Repository
            โ”‚ย ย  โ””โ”€โ”€ Doctrine
            โ””โ”€โ”€ Service

Inspiration

  • @moein and our work at trivago.
  • https://github.com/PhpFriendsOfDdd/state-of-the-union

Other implementations:

  • https://github.com/josecelano/ddd-symfony-sample
  • https://github.com/tyx/ddd-sample-symfony
  • https://github.com/leopro/trip-planner
  • https://github.com/tyx/cqrs-php-sandbox
  • https://github.com/dddinphp/ddd
  • https://github.com/codeliner/php-ddd-cargo-sample
  • https://github.com/qandidate-labs/broadway
  • https://github.com/jgimeno/taskreporter
  • https://github.com/ddd-php/ddd-components
  • https://github.com/webdevilopers/php-ddd

ToDo

  • Explain architecture.
  • Create sample app.

The Versions