Skip to content

hgraca/explicit-architecture-php-skeleton

Repository files navigation

Hgraca \ Explicit Architecture PHP Skeleton

This is a skeleton for a project following Explicit Architecture, specifically for a PHP project, although it can be easily adjusted to any programming language.

Usage

To use this skeleton we just need to clone this repo, make a few search/replace steps, and understand how/why the project structure is the way it is, so we can follow The Explicit Architecture principles.

Clone this repo:

git clone git@github.com:hgraca/explicit-architecture-php-skeleton.git lib-name

Replace:

  • Hgraca => The vendor name
  • '<lib-name-description>' => A description for the library
  • lib-name => The library name
  • LibName => The library namespace

Go through the README.md and adapt the template below to your situation.

Explicit Architecture

I explained Explicit Architecture in one of my blog posts, as a result of my understanding of several architectural styles such as (but not limited to) EBI Architecture, DDD, Ports & Adapters Architecture, Onion Architecture and Clean Architecture.

Explicit Architecture

Package by component

Package by component

Dependencies directions

Dependencies

Folder structure

  • bin (application binaries, the dependencies binaries should go in vendor/bin)
  • build (artifacts needed for building the application prior to running it)
  • config (all the config needed to run the application)
  • docs (application documentation)
  • lib (libraries used by the application, which are specific to this application or not distributable (yet))
    • shared-kernel (application and domain code shared among all components/bounded contexts)
      • src
      • tests
    • std-lib (functions and/or classes to be used as if they were part of the language itself)
      • src
      • tests
  • src
    • Core (the application core)
      • Component (the application components/bounded contexts)
      • Port (the ports, to be implemented by the infrastructure adapters)
    • Infrastructure (the port adapters for the infrastructure tools)
    • Presentation (the presentation layer with the several user facing applications, controllers, views and related code units)
  • tests (unit, integration, functional, acceptance tests)
    • build (artifacts needed for running the application tests, like a test DB template)
  • var (volatile artifacts like logs, cache, temporary test databases, generated code, ...)
  • vendor (distributable libraries)

Template for this readme.md:


Hgraca \ LibName

Author Software License Latest Version Total Downloads

Build Status Coverage Status Quality Score

<lib-name-description>

Add here a short description of what is the project. This should explain what the project is. Add here a short description of the motivation behind the creation and maintenance of the project. This should explain why the project exists.

Installation

To install the library, run the command below and you will get the latest version:

composer require hgraca/lib-name

Deployment

Add additional notes about how to deploy this on a live system

Available commands

make run
make test
make test-acc
make test-func
make test-int
make test-unit
make coverage
make cs-fix
make dep-install
make dep-update
make build-container-dev
make build-container-prd