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.
When it comes to installing the Symfony Standard DDD Edition, you have the following options.
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.
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
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.
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, YourNamespaceProjectModuleBundle
, shows you Symfony2 DDD architecture in action. After playing with it, you can remove it by following these steps:
- remove the routing entries referencing YourNamespaceProjectModuleBundle in
app/config/routing.yml
. - remove the YourNamespaceProjectModuleBundle from the registered bundles in
app/AppKernel.php
. - rename
src/YourNamespace/Project/Module
directory to fit your needs. - Remove all the
.gitkeep
files:find . -name .git -prune -o -type d -empty -exec touch {}/.gitkeep \;
- Copy folder structure from
Module
directory. - Add the configuration to this files, changing the path and the bundle name in each case:
app/config.yml
:
doctrine:
orm:
mappings:
YourNamespaceProjectModuleBundle:
type: yml
dir: '%kernel.root_dir%/../src/YourNamespace/Project/Module/Infrastructure/Mapping/Doctrine/ORM'
prefix: YourNamespace\Project\Module\Domain\Model
alias: YourNamespaceProjectModuleBundle
is_bundle: false
app/routing.yml
:
yournamespace_project_module_modulebundle:
resource: "@YourNamespaceProjectModuleBundle/Controller/"
type: annotation
app/AppKernel.php
:
<?php
public function registerBundles()
{
$bundles = [
new YourNamespace\Project\Module\Application\ModuleBundle\YourNamespaceProjectModuleBundle(),
];
}
The Symfony Standard DDD Edition is configured with the following defaults:
- A YourNamespaceProjectModuleBundle 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
All libraries and bundles included in the Symfony Standard Edition are released under the MIT or BSD license.
TODO: Explain different layers.
src
└── YourNamespace
└── Project
└── Module
├── Application
│ └── ModuleBundle
│ ├── Controller
│ ├── DependencyInjection
│ │ └── Compiler
│ └── Resources
│ ├── config
│ └── views
│ └── default
├── Domain
│ ├── Component
│ ├── Event
│ ├── Exception
│ ├── Model
│ ├── Repository
│ ├── Service
│ └── Value
├── Infrastructure
│ ├── Mapping
│ │ └── Doctrine
│ │ └── ORM
│ ├── Migrations
│ │ └── Doctrine
│ ├── Repository
│ │ └── Doctrine
│ │ └── ORM
│ └── Service
└── Tests
├── Domain
│ ├── Component
│ ├── Event
│ ├── Model
│ ├── Service
│ └── Value
└── Infrastructure
└── Service
- @moein and our work at trivago.
- https://github.com/PhpFriendsOfDdd/state-of-the-union
- 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
- Create command to generate automagically a new module.
- Explain architecture.
- Create sample app.