Download the PHP package antonyan/ddd-mappers-infrastructure without Composer
On this page you can find all versions of the php package antonyan/ddd-mappers-infrastructure. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download antonyan/ddd-mappers-infrastructure
More information about antonyan/ddd-mappers-infrastructure
Files in antonyan/ddd-mappers-infrastructure
Package ddd-mappers-infrastructure
Short Description DDD project infrastructure
License MIT
Informations about the package ddd-mappers-infrastructure
ddd-mappers-infrastructure
Infrastructure layer for DDD project based on Data Mapper as Data source pattern Data Mapper
General
In case if you use this layer with DDD project all functionality will be plugged automatically. An entry point is an Application class. Which uses Symfony HttpKernel as an engine.
Main flow
- An application gets a controller (Service of the presentation layer) and method from a request.
- Dispatch event for request preprocessing: filtering, validation etc.
- Call controller.
Dependency management
The architecture of the current application implies that main business logic will place in services. Each module and context will have representative service. Service extends BaseService which get a container (Dependency Injection) and config from "config" folder at the level above. On top of that container for each Service is automatically merged with infrastructure container.
Infrastructure container
Infrastructure container includes db connection, MySqlClient, RequestFactory, HttpClient.
DB interaction
Connection
If you're using MySQL as DB you should specify DDD_RBD_NAME, DDD_RBD_USER, DDD_RBD_PASSWORD, DDD_RBD_HOST, DDD_RBD_DRIVER (pdo_mysql) as env variables or just in .env file of the DDD project
DbMapper
For Rapid application development (RAD) we were created such abstraction as DbMapper. If you need CRUD implementation only it'll be supported out of the box. All that you need is to specify table and fields mapping in Module config. For create and update you should specify identifiers names. Config example:
Http interaction
HttpMapper
If the resource that you need you should get from another service (by HTTP(s)) you can use HTTP mapper which interface is similar to DbMapper. Config example:
Logging
For logging purpose we're using Monolog, but of course, we encapsulated it to rid of dependencies. We support logging to the file and to the CloudWatch. To use logging you should create Service (example):
On top of that, you should specify env variable with log destination LOGGING_TYPE = file or LOGGING_TYPE = cloudWatch
Customize your services
- is reserved service to override to handle api fail response on exception
All versions of ddd-mappers-infrastructure with dependencies
symfony/http-foundation Version ^4.1
symfony/routing Version ^4.1
symfony/http-kernel Version ^4.1
symfony/event-dispatcher Version ^4.1
symfony/dependency-injection Version ^4.1
doctrine/migrations Version ^1.8
doctrine/annotations Version ^1.6
symfony/validator Version ^4.1
vlucas/phpdotenv Version ^2.5
doctrine/dbal Version ^2.8
guzzlehttp/guzzle Version ^6.3
aws/aws-sdk-php Version ^3.24
aws/aws-php-sns-message-validator Version ^1.1
monolog/monolog Version ^1.21
maxbanton/cwh Version ^1.0