Questions tagged [codeigniter]

CodeIgniter is an open-source PHP web development framework created by EllisLab Inc and it has been adopted by British Columbia Institute of Technology. The framework implements a modified version of the Model-View-Controller design pattern. Use this tag for questions about CodeIgniter classes, methods, functions, syntax and use.

CodeIgniter is an web application framework created by EllisLab Inc and it is now a project of British Columbia Institute of Technology. The framework implements a modified version of the Model-View-Controller design pattern. It is praised for its performance and the quality of its documentation. It's currently licensed under the MIT License, although previous version were released under the Open Software License ("OSL") v. 3.0.

CodeIgniter is an open source rapid development web application framework, for use in building dynamic web sites with PHP. "Its goal is to enable [developers] to develop projects much faster than writing code from scratch, by providing a rich set of libraries for commonly needed tasks, as well as a simple interface and logical structure to access these libraries." The first public version of CodeIgniter was released on February 28, 2006, and the latest stable version 3.0.6 was released Mar 21, 2016.

CodeIgniter is loosely based on the popular Model-View-Controller development pattern. While view and controller classes are a necessary part of development under CodeIgniter, models are optional.

With more than 10k star on Codeigniter's repository, its also among the top 3 most starred PHP Framework on Github.com

These are generally regarded as pros of the framework:

  • Nearly zero configuration & No restrictive coding rules
  • Small footprint
  • Performance
  • Easy to learn
  • Great documentation

These are generally regarded as cons of the framework:

  • No built-in ORM
  • No built-in templating
  • Doesn't utilize namespaces
  • Doesn't utilize PHP's auto-loading feature
  • Application code is tightly-coupled with the framework

CodeIgniter Versions

Current Stable Version: 3.0.6 (Release Date: March 21, 2016)


Top Tips For Codeigniter

One of the most common asked questions in codeigniter on stack over flow is when I view my page I get error 404 page not found. There are a couple of solutions you should look at before asking question.

  1. Solution 1: Check the first letter of class name and filename of controller and models is Uppercase example: Welcome.php

  2. Solution 2: If base_url() returns unexpected results, it's because you have not set a $config['base_url'] value.

  3. Solution 3: If you have not configured your codeigniter application/config/config.php file to remove $config['index_page'] = ''; then you will need to include the index.php in your url

  4. Solution 4: After all settings you need to load the form url etc.. in autoload.php $autoload['helper'] = array('url', 'file','form','security');

http://www.example.com/index.php/site

Note you will need a htaccess file when your removing index.php htaccess for codeigniter 2 & 3


Frequently asked questions


Online resources

42 questions
14
votes
3 answers

Models per database table?

I am using codeigniter, and have found myself in a similar situation where I have repeated Model methods. I am creating a Model per Controller. But I would creating a Model per database table be considered good practice? That way methods aren't…
Howard Steff
  • 141
  • 1
  • 1
  • 3
9
votes
2 answers

Can REST API be used as business layer?

I am using PHP Codeigniter MVC design pattern and I had this project with some sort of specific business processes In my application I will be dealing with 2 existing REST APIs: Google Trello I came up with idea to create REST API to act as…
Ahmed Samy
  • 249
  • 2
  • 7
8
votes
1 answer

How to Properly Make use of Codeigniter's HMVC

I have been having problems wrapping my brain around how to properly utilize the modular extension for Codeigniter. From what I understand, modules should be entirely independent of one another so I can work on one module and not have to worry about…
Branden S. Smith
  • 181
  • 1
  • 1
  • 4
7
votes
2 answers

What is the correct way to implement Auth/ACL in MVC?

I am looking into making a correctly laid out MVC Auth/ACL system. I think I want the authentication of a user (and the session handling) to be separate from the ACL system. (I don't know why but this seems a good idea from the things I've…
WiseStrawberry
  • 171
  • 1
  • 3
6
votes
1 answer

PHP Framework for RESTful Web Service

I have been going round in circles with this question for days - which is the best PHP framework to use to create a RESTful Web service? I've trawled the web for info and have come across three main factors that are important: must have REST…
GWed
  • 3,085
  • 5
  • 26
  • 43
4
votes
4 answers

php templating with codeigniter

I am currently develop a website application in codeigniter, and I'd like to do something in PHP / CodeIgniter where I can make a common template for separate sections of the website. I was thinking that I would keep the header / footer in a…
JaPerk14
  • 141
  • 1
  • 1
  • 2
4
votes
1 answer

How to achieve N-Tier type in Codeigniter MVC

I know that N-Tier intended to separate layers on different network but I would like to have the same code separation in codeigniter I got this idea to have Model : for database CRUD - > Data layer REST API : for business logic—> Business layer …
Ahmed Samy
  • 249
  • 2
  • 7
4
votes
2 answers

Codeigniter/MVC workflow

Bit of a workflow question. I'm just staring with MVC and wondered how other people usually work in MVC? The 2 options I see is to code the model and controller completely first and then work on the views after. The other option is to code all parts…
David
  • 735
  • 8
  • 12
4
votes
3 answers

Controllers in CodeIgniter

I little bit new to the CodeIgniter framework and this is my first project with this framework. During a chat on StackOverflow somebody said that we need to make controllers tiny as possible. Currently I have a default controller named home with…
Red
  • 169
  • 1
  • 5
3
votes
2 answers

What license is applicable for an app based on CodeIgniter?

I am trying to fork an application that is based on CodeIgniter. According to the GoogleCode page, the license is GPLv3. However, examining the license.txt file inside the root directory of the application is very clearly not GPL (it does not…
user759147
  • 31
  • 2
3
votes
2 answers

Should on each test create and nuke a testing database?

In my case I inherited a poorly engineered code, on that piece of code I have been tasked to increase the code coverage in integration tests. But instead of the usual pattern: Create/Populate a test database with specific test data run the…
Dimitrios Desyllas
  • 451
  • 2
  • 4
  • 16
3
votes
0 answers

How to best approach adding a new template to an existing CodeIgniter project?

I am trying to add a new template to an existing CodeIgniter 3.0 project where the original developer had not planned for additional templates/themes. The primary objectives are to: a) make a usable copy of all existing views and css files and leave…
Billie M
  • 131
  • 2
3
votes
8 answers

If you were to build an app like Craigslist, would use an off-the-shelf framework or write your own?

Title is the question. And why I am asking is because from what I read about most PHP frameworks (e.g. Code Igniter, Kohana, Cake, Zend) is that they're ether too complex, or are designed mostly for small applications (like blogs).
mvbl fst
  • 133
  • 1
  • 5
3
votes
1 answer

Migrating Web based projects from Java to PHP

At our work place after hours of coding, testing and QA we have successfully added a couple of software tools in our product line. We specialize in web based software solutions so in order to tap on more users we are now considering putting our…
svg
  • 202
  • 1
  • 2
  • 7
3
votes
1 answer

How can I profile database queries from PHP?

CodeIgniter has a very nice feature called a Profiler, which displays information at the foot of a page, information such as GET, Memory, POST data. It also shows database queries and how long they took to run which I find very useful. I have…
Gortron
  • 700
  • 8
  • 15
1
2 3