Questions tagged [codeigniter]

CodeIgniter is an Application Development Framework - a toolkit - for people who build websites using PHP. Created by EllisLab & fostered by BCIT it is now a project of the CodeIgniter Foundation. 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. There are two major versions: 3.x and 4.x, addressing different system requirements

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 the previous version was released under the Open Software License ("OSL") v. 3.0.

CodeIgniter is an open-source rapid development web application framework for building dynamic websites 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 4.2.10 was released on November 5, 2022

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 18.2k stars on Codeigniter's repository, it's also among the 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
  • No restrictive coding rules

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: 4.2.10 (Release Date: November 5, 2022)


Top Tips For Codeigniter

One of the most commonly asked questions in Codeigniter on Stack Overflow is when I view my page and get the error 404 "Page Not Found". It would help if you looked at a couple of solutions before asking the question.

  1. Solution 1: Check the first letter of the class name and filename of the controller and models in the 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 you are removing index.php .htaccess for Codeigniter 2 & 3


Frequently asked questions


Online resources

69561 questions
6
votes
1 answer

Memory Leak in my PHP App (built with Codeigniter Framework)

I have a PHP app built on Codeigniter 1.7.2, currently in production and live, that seems to have a serious memory leak. The memory leak is apparent from looking at "top" on the server: top - 23:42:13 up 26 days, 10:14, 1 user, load average:…
PeterG
  • 772
  • 2
  • 11
  • 28
6
votes
2 answers

Which framework to use: CodeIgniter, Symfony or CakePHP?

I would like to use one of the framework listed in the title but I am afraid to choose the wrong one since I don't know much about the framework. I know PHP well, but every time I create a site I spent too much time creating my own little framework…
Larry S
  • 147
  • 2
  • 5
6
votes
5 answers

Why is MVC design pattern used extensively for website development?

I am developing my knowledge of OOP design patterns and as my main focus is website development and web app development, I have tried to find examples of design patterns in these fields but seem to come across web frameworks mainly (any other…
Matt Asbury
  • 5,644
  • 2
  • 21
  • 29
6
votes
2 answers

Set default (current datetime) to table column - CodeIgniter 3 migration

I have this migration: public function up(){ $this->dbforge->add_field([ 'id'=>['type'=>'int', 'unique'=>true, 'unsigned'=>true,'auto_increment'=>true], 'email'=>['type'=>'varchar', 'constraint'=>200, 'null'=>true], …
gdfgdfg
  • 3,181
  • 7
  • 37
  • 83
6
votes
2 answers

CodeIgniter MySQL query not working

I'm trying to get this query to work in CodeIgniter but it's spitting out an error: A Database Error Occurred Error Number: 1096 No tables used SELECT * If I put the query directly into MySQL it works fine (I replace the $variables with values).…
JoeM05
  • 914
  • 2
  • 10
  • 27
6
votes
2 answers

Routes not working codeigniter

Routes not working and default controller showing error 404 when I am setting welcome as a default controller then all routes defined with the welcome controller working but my other routes and url not working. $route['default_controller'] =…
Roshan Lal
  • 61
  • 1
  • 1
  • 2
6
votes
3 answers

DataTable with Ajax is not working well after use serverSide: true

I have an user table using DataTables, that will contain more than 200 rows. It's look so fine when I'm using DataTables for default the "pageLength": 10, and this is the table example. Username | Type | Request | user01 …
Zinc
  • 385
  • 1
  • 5
  • 19
6
votes
4 answers

How to upload file and insert data with php jquery ajax

I cannot send via ajax to php file upload and data with ajax. This my code just send file upload. data not send to my php code. I create form and the function send on click using ajax to post on php. I'm using codeigniter This my form:
Stfvns
  • 1,001
  • 5
  • 16
  • 42
6
votes
5 answers

Git environment for CodeIgniter project

I'm starting of with a new CI project based on the CI 2.0 Reactor repository. Because the CI2 code is still changing, I would like to keep that code fresh, the question is how (using Git). For the non-CI folks, the basic structure of a CI2 project…
joelcox
  • 562
  • 9
  • 19
6
votes
3 answers

How can I send trade offer

Actually I am working on Steam trade offer functionality, in which I am getting a problem. I have downloaded the Steam class library and implement it in Codeigniter. I am following the setup guide from…
Indresh Tayal
  • 276
  • 1
  • 11
6
votes
1 answer

Load map after clicking ajax request from marker of Google Map

Hi I'm encountering a problem regarding creating a new map upon clicking the marker. So here is the flow that I want: Display default google map with markers that I included - I'm okay with this Upon clicking of marker I'll create a new map which…
user3235016
  • 317
  • 2
  • 11
6
votes
3 answers

is it possible to convert a string to varbinary in PHP without using the SQL function

I was wondering if it is possible to convert a string to varbinary with PHP to get the same effect as with using the SQL function CONVERT(varbinary, 'data') I would like to do this because I am using codeigniter and would like to use active records…
Zen
  • 7,197
  • 8
  • 35
  • 57
6
votes
3 answers

Creating Block/Modules in Code Igniter

So far I've been enjoying using CodeIgniter to create some simple web apps (really just learning the framework), but I can't figure out an easy way to create a block/module. I would like to have have "Recent Images" block that I can drop on any page…
Rapture
  • 1,876
  • 10
  • 23
  • 42
6
votes
3 answers

How to make custom libraries in Laravel - as in codeigniter

i'm used to write a lot in codeigniter, where i try to place all logic code inside libraries instead of controllers. The idea is a controller calls a library that calls a model to get data. So whatever is happening inside a library, can be called…
Simos Fasouliotis
  • 1,383
  • 2
  • 16
  • 35
1 2 3
99
100