├── domain // Pure Domain Knowledge
│ ├── Base // Base Abstract Classes
│ ├── Application // Application Utility services
│ │ └── Contract
| | ├── Uuid
| | └── Transaction
│ ├── Model // Domain Model layer
│ │ ├── Entity
| | | ├── Base
| | | └── Tweet
│ │ ├── ValueObject
| | | ├── Base
| | | └── Tweet
│ │ └── DTO
| | ├── Base
| | └── Tweet
│ ├── Query // Belongs to ApplicationService, Abstract CQRS Query, not included concrete implementation
│ ├── Repository // Belongs to ApplicationService layer, not included concrete implementation
│ │ └── Contract
| | └── Tweet
│ └── UseCase // Belongs to ApplicationService layer, Accomplish use-case
|── infrastructure // Concrete Implementations. Should implement ApplicationService interface e.g RDBMS, HTTP Clients...
│ ├── Application // Concrete Utility Application services
| | ├── Uuid
| | └── Transaction
│ ├── Query // Concrete CQRS Query
| └── Repository // Concrete Repository
| ├── Base
│ │ └── InMemoryRepository // for testing
| └── Tweet
├── app // Laravel app
│ ├── Console
│ ├── Eloquent
│ ├── Exceptions
│ ├── Http
│ │ ├── Actions // For ADR pattern
│ │ │ ├── Frontend
│ │ │ └── Backend
│ │ ├── Responders // For ADR pattern
│ │ │ ├── Frontend
│ │ │ └── Backend
│ │ └── Middleware
│ ├── Providers
│ └── View
│ └── Components
│ └── Partial
├── bootstrap
│ └── cache
├── config
├── database
│ ├── factories
│ ├── migrations
│ └── seeds
├── docker // configs with using docker-compose
│ ├── mysql
│ │ └── init
│ ├── nginx
│ └── php
├── docs
│ └── architecture
├── public
├── resources
│ ├── js
│ │ └── components
│ ├── lang
│ │ └── en
│ ├── sass
│ └── views
│ ├── components
│ │ └── partial
│ ├── frontend
│ ├── backend
│ └── layouts
├── routes
├── storage
│ ├── app
│ │ └── public
│ ├── framework
│ └── logs
└── tests
├── Browser // for E2E
│ ├── Frontend
│ ├── Backend
│ ├── Pages
│ ├── console
│ └── screenshots
├── Helper // test helpers
│ ├── Domain
│ └── Utils
├── Feature
└── Unit
UnitTest:E2E = 8:2
程度を想定する。
infrastructure/Repository/Base/InMemoryRepository.php
class InMemoryTweetRepository extends InMemoryRepository implements TweetRepository
{
/**
* save Tweet entity.
*
* @param Tweet $tweet
* @return void
*/
public function save(Tweet $tweet): void
{
$this->saveInMemory($tweet);
}
}
dockerを予めインストールしてください。
clone
git clone https://github.com/naoyaUda/laravel-tweet-ddd.git
# コンテナのビルド、依存パッケージのインストール、DBの初期化を行う
make install
# permission変更
chmod -R 777 storage
chmod -R 777 bootstrap/cache
make help