Learn CodeIgniter from Scratch by Building a Project (003 - Taking a Look at Directory Structure)
Hey guys how you doing, We are now going to take a very quick look at the directory / folder structure of CodeIgniter we setup earlier in the series
To take a quick look at the directory structure, open the CodeIgniter directory / folder and you probably has a structure like this :
You will see three directories / folders namely application, system and user_guide along with some files let me explain what each file will do, and then we will take look inside the directories/ folders
- application [Directory] - this directory is where we will put all our files and in the scope of this series we will be working exclusively in this directory / folder only.
- system [Directory] - this directory is the backbone of the framework, and you should never make changes to any of these files ever.
- user_guide [Directory] - this directory contains the organized documentation of the CodeIgniter, if you are lost come to the user guide, it is well documented and organized. It is a good practice to delete the directory when you are delivering the final project, as this directory is only for the documentation purpose and does not play any role in creating our application.
- .editorconfig [File] - this is a file to set coding style in IDE
- .gitignore [File] - this file is for git. You can tell GIT,that certain files are not allowed to be loaded into git.
- composer.json [FIle] - this file is for the libraries in PHP. It controls the loading and includes all dependencies.
- contributing.md [FIle] - contains guidelines for contribution, for example, in an open-source project this file plays an important role to provide guidelines for coding standards.
- index.php [File] - most important file, any request you will made will be routed through this file
- license.txt [File] - CodeIgniter license file
- readme.rst [File] - this file only contains information of the current release of the CodeIgniter
Oh my god, you are overwhelmed, don't be, I only included them just for reference we will not be working any of the files except for the application directory / folder and the index.php file, so hang in there. Next stop is to open the application directory, and by taking a look we will find the structure similar to the one below :
Are you getting bore from all this theory, me too !, so just don't bother all the directories / folders, only we will talk about the directories / folders we will be working throughout our series and to create our project, we will take all the other directories / folders in the end of the series, in that way it will make sense to you. The directories / folders of our concern are :
- config [ This a very special directory / folder and used to configure main areas of our application]
- controllers [ As the name suggests, this directory / folder will hold all our controllers]
- models [ You guess it right, this directory / folder holds all the models]
- views [Right again, this directory / folder will hold all our views the pages we will see in our browser]
- helpers [Well its too early to discuss now, but this directory / folder will hold files that contains functions that we can use anywhere in our application, for example formatting a date to different formats]
That is all for this part, I know you are probably getting very bored of the theory, the good news is from the next part we will begin coding and start our project. See you then.