Codeigniter 4 - Application Folder/Directory Structure Example




Codeigniter 4 - Application Folder/Directory Structure Example

Hi Guys,

Today, I will let you know an example of the Codeigniter 4 directory structure. This tutorial will give you a simple example of the PHP Codeigniter folder structure. This article will give you a simple example of the Codeigniter getting an application folder path. I would like to show you Codeigniter 4 folder structure.

Let's see how to work Codeigniter 4 below folder/directory structure follow my simple steps.

Step 1: Install Codeigniter 4

This is optional; however, if you have not created the codeigniter app, then you may go ahead and execute the below command:

composer create-project codeigniter4/appstarter ci-news

First of all successfully run your project got to your project folder directories bellow given image you looks like Codeigniter 4 new directory structure:

Newly install you have a six directories folder in your codeigniter 4 project.

  • /app
  • /system
  • /public
  • /writable
  • /tests
  • /docs

So, i will explain each of directories how actually work in codeigniter 4 project.


In this first /app directory where all of your application code lives. This comes with a default directory structure that works well for many applications. The following folders make up the rudimental contents:

  • /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.


In this \system this folder contains the framework core files. It is not advised to make changes in this directory or put your own application code into this directory.

This directory stores the files that make up the framework, itself. While you have a lot of flexibility in how you use the application directory, the files in the system directory should never be modified. Instead, you should extend the classes, or create new classes, to provide the desired functionality.

All files in this directory live under the CodeIgniter namespace.


Public folder was introduced in Codelgniter 4. The public folder holds the browser-accessible portion of your web application, preventing direct access to your source code. It contains the main .htaccess file, index.php, and any application assets that you add, like CSS, javascript, or images.

This folder is meant to be the “web root” of your site, and your web server would be configured to point to it.


This includes directories for storing cache files, logs, and any uploads a user might send. You should add any other directories that your application will need to write to here, This allows you to keep your other primary directories non-writable as an added security measure.


This directory is set up to hold your test files. The _support directory holds various mock classes and other utilities that you can use while writing your tests. This directory does not need to be transferred to your production servers.


In this directory is part of your project, it holds a local copy of the CodeIgniter4 User Guide.

It will help you...

#Codeigniter 4