Hello everyone dear Habrahabr. In this article we will talk about the wonderful PHP framework CodeIgniter (abbreviated CI). CodeIgniter is a popular open source PHP framework that allows you to create rich and secure web applications with MVC architecture. Developed by EllisLab.
Why do everything from scratch and rewrite 1000 lines of code each time? Why spend a lot of time on the concept of your own code? You are lucky if your project has few lines of code and it is well documented, but if you have more than 1000 files and the code is ugly scattered in addition, then a small fix can take a lot of time. There is an exit! Sooner or later you will have to use the framework.
So what is a framework
Framework (framework, structure) - software that facilitates the development and integration of various components of a large software project. Unlike libraries that combine a set of routines of similar functionality, the framework contains a large number of libraries of different purposes.
')
Personal experience
When I started developing applications in pure PHP, I spent a lot of time, I was looking for a bug for a long time, and rewriting many lines of code. Later I began to use functions, but this also did not save. I have been googling for a very long time and have found the perfect solution - using frameworks. At the moment I am using CodeIgniter, which I will now discuss.
Why CodeIgniter
CodeIgniter is a PHP framework. The first public release of CI took place in 2006 (7 years ago). He quickly gained popularity due to its simplicity and speed. At the moment, the current version
2.1.3. CodeIgniter uses MVC architecture, which allows everything to be expanded. Below you can see the process of working CI. It will support libraries, helper, hooks. There is also a built-in caching system.

And so about the pros CodeIgniter
Excellent and clear documentation
Indeed, CodeIgniter has very rich and understandable documentation, and it is nice to read it. Everything is explained by examples of code that can be simply copied and used at home. Also, the documentation has long been translated into Russian, so that you do not have much difficulty to learn CodeIgniter.
Does not require a large amount of resources
CodeIgniter can work on almost all hosting with PHP support of at least 5.1 version. Due to its competent structure, CI does not load the system and works very well. Now I will not compare the speed of work with other frameworks, as holivars need nothing.
Very easy to use
Developing applications with CodeIgniter has a different style than simply writing in pure PHP. It will seem to you that you need to learn a lot in order to develop on the framework, but I will please you, CI learns very easily and quickly. On CodeIgniter, you can develop light and medium applications, but for more complex projects it is better to choose another framework.
Page generation speed.
CodeIgniter is very fast in operation. And this is true, and if you do not believe, then you can check for yourself.
Support a large number of databases
Using its built-in drivers, CodeIgniter can work with different databases, such as: MySQL, PostgreSQL, MSSQL, SQLite, Oracle. There is also a PDO driver, which is extremely convenient. CI has an ActiveRecord design pattern for working with databases.
A large number of standard libraries and classes
So that you would not want to do it, CodeIgniter will find a solution to most of your ideas. I will not list all libraries, helpers and classes, since there are a lot of them. But I list which I use: pagination, captcha_helper, form validation, xmlrpc, email, url_helper, security_helper.
Multiple CI resources.
On the Internet there are a huge number of sites dedicated to CodeIgniter. So, finding third-party libraries or finding the answer to your CI question will not be difficult. Below in the article there will be links to various resources.
Cons CI
Weak caching system
The caching system in CodeIgniter works only with whole pages, but with parts of the page, and this is not very convenient. And this means that you will have to write your own caching system or fasten ready-made options. Although at this speed, caching is not necessary.
Bad writing style
CodeIgniter allows you to completely abandon the model, which is not good. CI teaches with loose programming style. Also, class inheritance is not very well developed, sometimes using procedural code.
No registry pattern
Because of the absence of the Registry pattern, you have to write the rather stupid thing "$ CI = & getInstance ();" for library access to the core framework.
Code examples
Just a few lines are required to insert the code into the database.
$insert = array( 'title' => ' CodeIgniter' , 'author' => 'Mister Yio' , 'text' => 'BlaBlaBla' );
It is also easy to get data and transfer it to your mind.
public function getSingl($name){ $this->db->where('name', $name);
Below is the standard model for working with the database.
<?php class Model_posts extends CI_Model{ public function getAll(){ $query = $this->db->get('posts');
CodeIgniter based projects
A large number of cms and scripts are based on CodeIgniter. The most famous: MaxSite CMS, ImageCMS, CI-CMS, Blaze. (Someday this list will replenish me)