+1 (614) 348-7474

Copy

Free in USA

info@crocoapps.com

Copy

From 10:00 to 21:00

info@crocoapps.com

Copy

From 10:00 to 21:00

Fill out the brief

Online request

#

Guide to CodeIgniter

Crocoapps editorial

Crocoapps editorial

Reading time: 7 minutes

CodeIgniter is a powerful, very lightweight PHP framework designed for developers who need a simple and elegant toolkit to build rich web applications. CodeIgniter was created by EllisLab, and is currently a project of the British Columbia Institute of Technology.

If you know PHP well, then CodeIgniter will make your task easier. It has a very rich set of libraries and helpers. By using CodeIgniter, you will save a lot of time if you are developing a website from scratch. In addition, the website embedded in CodeIgniter is also secure as it has the ability to prevent various attacks that occur through websites.

CodeIgniter Tutorial

Some of the important CodeIgniter features:

  • model view controller based system
  • extremely light weight
  • full-featured database classes with support for multiple platforms
  • Query Builder database support
  • form and data validation
  • security and XSS filtering
  • session management
  • Send email class: supports attachments, HTML/text email, multiple protocols (sendmail, SMTP and Mail) and more
  • image processing library (cropping, resizing, rotation, etc.), support for GD, ImageMagick and NetPBM
  • file upload class
  • FTP class
  • localization
  • pagination
  • data encryption
  • testing
  • full page caching
  • error log
  • application profiling
  • calendar class
  • user agent class
  • Zip encoding class
  • template engine class
  • Trackback class
  • XML-RPC library
  • unit test class
  • searchable URLs
  • flexible URI routing
  • support for hooks and class extensions
  • large library of "helper" functions
Installing CodeIgniter

Installing CodeIgniter

It's very easy to install CodeIgniter. Just follow the instructions below:

  1. Download CodeIgniter from CodeIgniter.

There are two different options, legacy and latest. The names themselves are self-descriptive. legacy has version less than 2.x and latest has version 3.0.

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

  1. Unzip the folder.
  2. Upload all files and folders to your server. After uploading all the files to your server, visit your server URL.

The architecture of the CodeIgniter application is shown below.

CodeIgniter application architecture
  • As shown in the figure, whenever a request comes into CodeIgniter, it will first go to the index.php page.
  • In the second step, routing will decide whether to pass this request for caching or pass this request to for security.
  • If the requested page is already in caching, then routing will pass the request and the response will be returned to the user.
  • If the requested page does not exist in the cache, then routing will pass the requested page for security checks.
  • Before passing the request to the Application Controller, the security of the submitted data is checked. After security checks, the application controller loads the necessary models, libraries, helpers, plugins, and scripts and submits them for viewing.
  • The View will render the page with the available data and pass it in for caching. Since the requested page was not cached before, so this time it will be cached in caching to quickly process this page for future requests.

CodeIgniter directory structure is divided into 3 folders:

  • Application
  • System
  • User's Guide

Application

Because the name indicates that the application folder contains all the code for your application that you create. This is the folder where you will develop your project. The application folder contains several other folders, which are described below:

  • Cache - This folder contains all cached pages in your application. These cached pages will increase your overall page access speed.
  • Config - This folder contains various files for configuring the application. Using the config.php-file, the user can configure the application. Using the database.php-file, the user can configure the application's database.
  • Controllers - This folder contains your application's controllers. This is the main part of your application.
  • Core - this folder will contain the base class of your application.
  • Helpers - in this folder you can put your application's helper class.
  • Hooks - The files in this folder provide a means to hook in and change the inner workings of the framework without breaking the core files.
  • Language - This folder contains language related files.
  • Libraries - this folder contains files of libraries developed for your application.
  • Logs - This folder contains files related to the system log.
  • Models - database login will be placed in this folder.
  • Third_party - in this folder you can place any plugins that will be used for your application.
  • Views - Application HTML files will be placed in this folder.

System

This folder contains the core CodeIgniter codes, libraries, helpers, and other files that help make coding easier. These libraries and helpers are downloaded and used in web application development.

CodeIgniter

This folder contains all CodeIgniter consequence code, organized into different folders:

  • Core - This folder contains the CodeIgniter core class. Don't change anything here. All your work will take place in the application folder. Even if you intend to extend the core of CodeIgniter, you must do so with hooks, and hooks live in the application folder.
  • Database - The database folder contains the main database drivers and other database utilities.
  • Fonts - fonts folder contains information about fonts and related utilities.
  • Helpers - the helpers folder contains standard CodeIgniter helpers (such as date, cookie, and URL helpers).
  • Language - language folder contains language files. In the meantime, you can ignore it.
  • Libraries - The libraries folder contains the standard CodeIgniter libraries (to help you with email, calendars, file uploads, and more). You can create your own libraries or extend (and even replace) the default ones in the apps/libraries directory to keep them separate from the standard CodeIgniter libraries saved in that particular folder.

User Guide

This is your user guide for CodeIgniter. This is basically the standalone version of the user guide on the CodeIgniter website. With it, you can explore the functions of various libraries, helpers and classes. It is recommended that you go through this user guide before building your first web application with CodeIgniter.

Besides these three folders, there is another important file named "index.php". In this file, we can set the application environment and error level, and define the system and application folder name. It is recommended that you do not edit these settings if you do not have enough knowledge about what you are going to do.

Author

Crocoapps editorial

Crocoapps editorial