Skip to main content

Directory Structure

The default Formidable application structure is intended to provide a great starting point for both large and small applications. But you are free to organize your application however you like. Formidable imposes no restrictions on where any given class is located.

Overview

.
├── app
├── Console
└── Commands
├── Exceptions
├── Http
├── Controllers
├── Middleware
└── Requests
├── Interfaces
├── Mail
├── Resolvers
└── Types
├── bootstrap
└── cache
├── config
├── database
├── migrations
└── seeds
├── public
├── resources
├── lang
└── views
├── routes
├── storage
├── framework
├── logs
└── session
└── test

The Root Directory

app

Contains the core code of your application.

app/Console/Commands

Houses application commands.

app/Exceptions

Houses application exceptions.

app/Http/Controllers

Contains applicaiton controllers.

app/Http/Middleware

Contains request middlewares.

app/Http/Requests

Contains requests classes.

app/Interfaces

Houses application interfaces.

app/Mail

Contains application mailers.

app/Resolvers

Contains application service resolvers.

app/Types

Houses application types.

bootstrap/cache

Contains the cached config file and database settings file.

config

Contains application configuration files.

database/migrations

Houses your application migration files.

database/seeds

Houses your application seeders.

public

Houses your assets such as images, JavaScript, and CSS.

resources/lang

Contains language files.

resources/views

Houses your Formidable View classes.

routes

Contains application routes.

storage/framework

Contains core application data.

storage/logs

Contains application logs.

storage/session

Contains application sessions.

Domain Driven Design

Should you feel that you need more control over the structure of your application, you may go the Domain Driven Design route. When using Domain Driven Design, you can use the --domain flag for the supported make commands:

node craftsman make:type Customer --domain=Customers

This command, will create a Customer type and put it under the app/Domain/Customers/Types directory. You can also add more classes, and files under a specific domain.

Supported Commands

Below, is a list of all the make commands that support the --domain flag.

CommandDescription
make:commandCreate a new command class
make:controllerCreate a new controller class
make:crudCreate a new crud
make:exceptionCreate a new exception class
make:interfaceCreate a new interface
make:mailCreate a new email class
make:middlewareCreate a new middleware class
make:repositoryCreate a new repository class
make:requestCreate a new form request class
make:resolverCreate a new resolver class
make:typeCreate a new resolver class
info

You can re-arrange your make generated files for make commands that don't support the --domain flag.