项目作者: pgrau

项目描述 :
Training some best practices of modern PHP development
高级语言: JavaScript
项目地址: git://github.com/pgrau/ddd.git
创建时间: 2016-03-31T22:13:42Z
项目社区:https://github.com/pgrau/ddd

开源协议:

下载


DDD and Hexagonal Architecture Application

Build Status
Coverage Status

  1. Training some best practices of modern PHP development
  2. By default this app uses:
  3. Fast route
  4. Service Container
  5. Doctrine 2
  6. Plates
  7. Symfony command line
  8. You can create new users with the follow command:
  9. (before execute this command follow the instructions of the docs)
  10. php console user:create

Install components

  1. curl -sS https://getcomposer.org/installer | php
  2. php composer.phar install

Vagrant

  1. Debian 8 Vagrant image
  2. which is preconfigured for testing PHP apps and developing extensions across many versions of PHP.
  3. You can see all documentation in doc/vagrant or https://github.com/rlerdorf/php7dev

Set up the project with Vagrant

  1. Edit your /etc/hosts file
  2. 192.168.7.8 training.dev
  3. vagrant up
  4. vagrant ssh
  5. Edit nginx config. file
  6. sudo vim /etc/nginx/conf.d/default.conf
  7. and change root:
  8. root /var/www/default/public;
  9. sudo service nginx reload
  10. You can run now the app in your browser: http://training.dev

MySQL

  1. Vagrant contain a MySQL
  2. Execute the follow command:
  3. ssh -C -N -f -L3306:127.0.0.1:3306 vagrant@192.168.7.8
  4. And execute the SQL needed to update the database schema:
  5. php bin/doctrine orm:schema-tool:update --force

Message Queue

  1. Vagrant contain a RabbitMQ
  2. user vagrant
  3. pwd vagrant
  4. http://training.dev:15672

Coding Style Guide

PSR-2

Routes

  1. FastRoute link - Fast request router for PHP https://github.com/nikic/FastRoute

Service Container (Dependency Injection)

  1. Small but powerful dependency injection container http://container.thephpleague.com

ORM

  1. Doctrine 2 is an object-relational mapper (ORM) for PHP 5.4+
  2. Mapping files are available in:
  3. src/Training/Infrastructure/Persistence/Doctrine/mapping

Templates

  1. Native PHP template system http://platesphp.com
  2. All templates are in: src/Training/Infrastructure/UI/View/Plates

Controllers

  1. All controllers are in: src/Training/Infrastructure/UI/Controller

Command-line commands

  1. Symfony Console Component
  2. The Console component eases the creation of beautiful and testable command line interfaces.
  3. You can run the command lines with the follow command: php console

Unit Tests

  1. Unit Tests are available.
  2. You can run the tests with the follow command: php bin/phpunit