Giter VIP home page Giter VIP logo

symfony-ddd-edition's Introduction

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.

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

Installing the Symfony Standard DDD Edition

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

Use Composer (recommended)

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

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

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

Then, use the create-project command to generate a new Symfony application:

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.

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.

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:

php composer.phar install

Checking your System Configuration

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

Execute the check.php script from the command line:

php bin/symfony_requirements

Access the config.php script from a browser:

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

If you get any warnings or recommendations, fix them before moving on.

Getting started with Symfony

This distribution is meant to be the starting point for your Symfony applications.

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

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

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 \;

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.

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.

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 (in dev/test env) - Adds code generation capabilities
  • DebugBundle (in dev/test env) - Adds Debug and VarDumper component integration
  • SymfonyDDDGeneratorBundle (in dev/test env) - Adds code generation capabilities specifically for this Symfony distribution.

All libraries and bundles included in the Symfony Standard Edition are released under the MIT or BSD license.

Architecture

TODO: Explain different layers.

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

Other implementations:

ToDo

  • Explain architecture.
  • Create sample app.

symfony-ddd-edition's People

Contributors

regniblod avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

symfony-ddd-edition's Issues

Framework Bundle should go into Infrastructure Layer

Framework Bundle and framework specific stuff should go into Infrastructure Layer.

Why
From http://dddsample.sourceforge.net/architecture.html Infrastructure: It handles interpretation, validation and translation of incoming data. It also handles serialization of outgoing data, such as HTML or XML across HTTP to web browsers or web service clients
Application Layer: The application layer is thin in terms of domain logic - it merely coordinates the domain layer objects to perform the actual work.
I think what it should belong to Application layer is not more than Controllers (usually also Commands in a command bus driven approach) that are responsible for coordinating the objects and the workflow for the application.
In Symfony also, the bundle is used as a standard place for doctrine schema generation, Doctrine Repositories, Views (which should not be part of the application Layer).
And as I see from your structure, we have to do, kind of work-around for doctrine mappings located out of the Bundle scope.

Usecase https://github.com/mathiasverraes/symfony-live-2014/tree/master/src/Infrastructure/LessonScheduleBundle this is a scaffolding from Mathias Verraes DDD workshop just as a comproving example

I'm going to find and provide some more authoritative sources and examples.
What do you think? :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.