For any queries you can reach us at infovistarindia@gmail.com / WhatsApp us: +919158876092

CodeIgniter 4 Application Structure

Overview

You need to understand how the application is structured.

Default Directories

A fresh install has six directories:

  • /app,
  • /system,
  • /public,
  • /writable,
  • /tests
  • /docs.
Each of these directories has a very specific part to play.

/app

The source code of the project resides in the app directory. The following folders make up the basic contents:

/app
	/Config         Stores the configuration files
	/Controllers    Controllers determine the program flow
	/Database       Stores the database migrations and seeds files
	/Filters        Stores filter classes that can run before and after controller
	/Helpers        Helpers store collections of standalone functions
	/Language       Multiple language support reads the language strings from here
	/Libraries      Useful classes that don't fit in another category
	/Models         Models work with the database to represent the business entities.
	/ThirdParty     ThirdParty libraries that can be used in application
	/Views          Views make up the HTML that is displayed to the client.

All files in this directory inside the App namespace, though you are free to change that in app/Config/Constants.php.

system

This directory stores the files that make up the framework. The files in the system directory should never be modified.

public

The public folder contains the required assets for the application such as css, javascript and images.

writable

This includes directories for storing cache files, logs, and any uploads a user might send.

tests

This directory contains your test files.

docs

It holds a local copy of the CodeIgniter4 User Guide.