Codeigniter: How to Start Work with Codeigniter

Krushabh Suryawanshi
Published in
4 min readSep 10, 2020

--

Hi!

I Think You Must Be A PHP Developer Who Wants To Get Knowledge For Framework Of PHP. You Must Have Searched For Top Framework Of PHP. And You Would Come To Known That Codeigniter Is the Best and Powerful Framework of PHP. I Am Glad That You Are Interested In Learning Codeigniter and You Have Chosen This Article To Read More About How To Use Codeigniter.

Recent Update of Codeigniter Is 4.0.3 ( released on 2020–05–01)

Before We Start You Must Have All Prerequisite As Follow

Please Note. Here We Are Going To Discuss Codeigniter On Windows Only.

Prerequisite:

Xamp Or Wamp Server for PHP Localhost. (PHP + MySQL)

{Current supported databases are MySQL (4.1+), MySQLi, MS SQL, Postgres, Oracle, SQLite, and ODBC.}

Here I Have Used Xamp.

Ok, So Lets Starts.

Step 1:

Downloading Codeigniter File.

You Can Download Codeigniter From Here(http://codeigniter.com/download)

If You Think You Should Start From Basic Go with v3.0 else Let’s Start With v4.0

Here We Are Going Intermediate For Both versions.

To know What Is New In Codeigniter 4 Go With()

We can also go with GitHub and get all of the latest scripts.

Step 2:

Unzip The Folder.

You’re Downloaded File Is Zipped With File Explorer You Can Unzip It Very Easily.

Step 3:

If You Have Worked With PHP You Know That Our All Files Are Served From Xamp/htdocs Folders Right?

So, Our Next Task Is to Copy And Paste Folder As It Is In Xamp/htdocs

For Wamp

That’s Now Fine.

Step 4:

Now As Usual’s Rename Folder Of Your Own.

Suppose I Have Change Folder Name To ‘Mycode’

Fine.

So I Will Start PHP MySQL With Xamp

And Type Following URL in the Address Bar Of My browser as http://localhost/mycode

And I Will Get This Window.

Congratulations!

You Are Now Known Of How To Install Codeigniter.

Now It’s Time To Know What Is Inside Codeigniter Folder.

So Let’s Start

Now We’ll Go With the Structure Of the Directory first.

When You Open Codeigniter Folder (Mycode In My Case) You Will Three Folder They Are

Application

System

User Guide

Application:

As the name indicates the Application folder contains all the code of your application that you are building. This is the folder where you will develop your project.

It Has the following Folder:

Cache

Config

Controllers

Core

Helpers

Hooks

Language

Libraries

Logs

Models

Third_party

Views

Here Will Discuss Config, Controllers, Models, and Views Only.

Config:

This folder contains various files to configure the application. With the help of config.php file, the user can configure the application. Using database.php file, the user can configure the database of the application

Controllers:

This Is the Most Important Folder Of the Codeigniter Application. This Folder Holds All Control Over Our Application.

Models:

Various Sql queries Are Written In This Folder i.e. Connection With Database Are Made From This Folder Only.

Views:

As Similar To Name All HTML PHP Code Which Are Visible To User Are Written In Views Folder.

How Codeigniter Works?

As PHP, As Soon As Request Come It Is redirected To Index.php rights same with Codeigniter.

Let’s In My Computer I enter https://localhost/mycode

The Window Visible Is Only Index.php file.

The main parts of Codeigniter Are Follow

Routing

Caching

Security

Application Controllers

View

Application Controllers Are:

Model

Library

Helpers

Pluggin

Script

In the Second Step,

Routing Will Decide whether to pass the request to

Then In the Third Step,

Caching And Then For Security.

If the requested page is already in Caching, then Routing will pass the request to step-3 and the response will go back to the user

Before passing the request to Application Controller, the Security of the submitted data is checked. After the Security check, the Application Controller loads necessary Models, Libraries, Helpers, Plugins and Scripts and pass it on to View

The View will render the page with available data and pass it on for Caching. As the requested page was not cached before so this time it will be cached in Caching, to process this page quickly for future requests

In This Way Codeigniter Works.

Now We’ll Start Learning Codeigniter With Practical.

We Are Going To Create A CRUD app With Codeigniter in next article

Till Then

Thank You!

Have Good Day

And

Most Important

Keep Reading.

--

--

GDSC DYPCOE
GDSC DYPCOE

Published in GDSC DYPCOE

The latest posts from students of D. Y. Patil College of Engineering, Pune.

Krushabh Suryawanshi
Krushabh Suryawanshi

Written by Krushabh Suryawanshi

Student of Information Technology from D. Y. Patil College of Engineering Pune