Skip to content

Application Structure Description

sunrise-php edited this page Jan 7, 2019 · 2 revisions

Base structure of the application

├── config
│   ├── cli-config.php
│   ├── container.php
│   ├── definitions.php
│   └── environment.php
├── public
│   └── index.php
├── src
│   ├── Entity
│   │   └── AbstractEntity.php
│   ├── Exception
│   └── Http
│       ├── Controller
│       │   └── HomeController.php
│       ├── Middleware
│       └── App.php
└── tests

Directories description

Directory Description
config Must contain the application configs
public Must contain the application entry point and any public files
src Must contain the application classes
src/Entity Must contain the application models (entities for Doctrine ORM)
src/Exception Must contain the application exceptions
src/Http/Controller Must contain the application controllers
src/Http/Middleware Must contain the application middlewares
tests Must contain any tests for the application

Files description

File Description
config/cli-config.php Setup to run Doctrine in CLI mode (source)
config/container.php PHP-DI build (source)
config/definitions.php The application dependencies
config/environment.php The application environment options
public/index.php The application entry point (the web server should proxy to this file, and only to it)
src/Entity/AbstractEntity.php All models (entities) must be extended by it class for validation to be available
src/Http/Controller/HomeController.php Demo controller for home page
src/Http/App.php This class runs the application

Clone this wiki locally