In CodeIgniter 4, you need to understand how the application is structured, by default, and what you can change to meet the needs of your application.
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.
In CodeIgniter 4, you need to understand how the application is structured, by default, and what you can change to meet the needs of your application.
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 are 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.
Modifying Directory Locations
If you’ve relocated any of the main directories, you can change the configuration settings inside app/Config/Paths.php.