Codeigniter: Ellislab. Our Main Focus in This Paper Is On This Framework, But We Will Try Do A Comparison With
Codeigniter: Ellislab. Our Main Focus in This Paper Is On This Framework, But We Will Try Do A Comparison With
Introduction
Software applications nowadays and especially web applications tend to be prototyped and developed in a short amount of time. This is why developers tend to have a RAD (Rapid Application Development approach and use framewor!s in developing applications. RAD approaches may entail compromises in functionality and performance in e"change for enabling faster development and facilitating application maintenance# but the framewor!s compensate some of these compromises. $n the mar!et there are many framewor!s based on several programming languages# but in this tutorial we are going to focus ourselves on CodeIgniter a PHP framework developed by EllisLab. $ur main focus in this paper is on this framewor!# but we will try do a comparison with several similar framewor!s to see the difference in performance# concepts and techni%ues.
About CodeIgniter
CodeIgniter is a very light# easy to use and well performing framewor!. &hile# it is perfect for a beginner# it's also perfect for large and demanding web applications. CodeIgniter is developed by (llis)ab# as we said earlier# and has an easy to understand documentation and a lot of educational resources. *elow we presented a list of reasons of what ma!es us choose CodeIgniter as our framewor!+ Small footprint with e"ceptional performance ,-C approach to development (although it is very loosely based which allows for fle"ibility .enerates search engine friendly clean /R)s Runs on both 010 2 and 3 Support for most ma4or databases including ,yS5)# ,yS5)i# ,S S5)# 0ostgres# $racle# S5)ite# and $D*C. (asy caching operations ,any libraries and helpers to help you with comple" operations such as email# image manipulation# form validation# file uploading# sessions# multilingual apps and creating apis for your app ,ost libraries are only loaded when needed which cuts bac! on resources needed. CodeIgniter uses the ,odel6-iew6Controller (,-C approach similar to most available framewor!s# however# it is a bit loose in it7s approach to ,-C as a model does not have to be used. As we mention it is lightweight# which means it starts you off with 4ust the basic libraries and you can load more if needed. Regarding libraries# the framewor! comes with a nice selection of libraries to get you going %uic!ly# such as connecting to a database# sending email# validating form data# maintaining sessions# manipulating images# and more. Another important aspect is that the user guide comes with the installation files and community forums are active and contain a lot of helpful answers to several problems. *esides the ,-C approach CodeIgniter uses scaffolding which is an automated way of generating a view based on the model. Scaffolding is meant for simple prototyping and CodeIgniter ta!es it a step further by re%uiring a !eyword in the /R) to even access the scaffolding. 010 framewor!s have mostly the same functions and options#this is why we are going to 8
compare Codeigniter with a different language framewor!# D4ango which is based on 0ython. *oth framewor!s use a ,-C approach# rely on rapid development and the DR9 (Don't Repeat 9ourself principle. D4ango provides an optional administrative :CR/D: interface that is generated dynamically through introspection and configured via admin models. This is a very useful feature when handling the data. &e can spot some advantages of the 010 framewor! right away given by the installation issues of D4ango+ 8. D4ango installation and configuration assumes you have access to a shell# although we could offer installation service# but not on specific servers. ;. D4ango runs only on some specific hosts that ta!e must ta!e special care to enable it# installing mod<python=mod<wsgi which is a problem if you don't have access to the console. >. /sing 010 would mean we could run it on their e"isting server+ this means no need to move them to a D4ango6enabled server# and no downtime for their emails# while D?S updates. @rom a performance point of view D4ango has a clear advantage due to the least use of the processor. Also the core of the D4ango framewor! consists of an ob4ect6relational mapper which mediates between data models and a relational databaseA a regular6e"pression6based /R) dispatcherA a view system for processing re%uestsA and a templating system. ,ost of these functions don't e"ist or a limited in the CodeIgniter pro4ect. Still CodeIgniter is the framewor! we chose for simplicity purposes and wide e"tension of the php language# and the fact that CodeIgnier pro4ects are easier to handle# and run Bright of the bo"C than the D4ango pro4ects wich re%uire a running server.
The system folder stores all the files which ma!e CodeIgniter wor!. The application folder is almost identical to the contents of the system folder this is so the user can have files that are particular to that application# for e"ample if a user only wanted to load a helper in one application he would place it in the system#application#helpers folder instead of the system#helpers folder. The config folder stores all the config files relevant to the application. &hich includes information on what libaries the application should auto load and database details. The controllers folder stores all the controllers for the application. The errors folder stores all the template error pages for the application. &hen an error occurs the error page is generated from one of these templates. The helpers folder stores all the helpers which are specific to your application. The hooks folder is for hoo!s which modify the functioning of CodeIgniter's core files# hoo!s should only be used by advanced users of CodeIgniter The language folder stores lines of te"t which can be loaded through the language library to create multilingual sites. The libraries folder stores all the libraries which are specific to your application. The models folder stores all the models for the application. The views folder stores all the views for the application. The cache folder stores all the caches generated by the caching library. The codeigniter folder stores all the internals which ma!e CodeIgniter wor!. The database folder stores all the database drivers and class which enable you to connect to database. The fonts folder stores all the fonts which can be used by the image manipulation library. The helpers folder stores all of CodeIgniter's core helpers but you can place your own helpers in here which can be accessed by all of your applications. The language folder stores all of CodeIgniter's core language files which its libaries and helpers use. 9ou can also put your own language folders which can accessed by all of your applications. The libaries folder stores all of CodeIgniter's core libaries but you can place your own libraries in here which can be accessed by all of your applications The logs folder stores all of the logs generated by CodeIgniter. The plugin folder stores all of the plugins which you can use. 0lugins are almost identical to helpers# plugins are functions intended to be shared by the community. The scaffolding folder stores all the files which ma!e the scaffolding class wor!. Scaffolding provides a convenient CR/D li!e interface to access information in your database during development. The user$guide houses the user guide to CodeIgniter. The index!php file is the bit that does all the CodeIgniter magic it also lets the you change the name of the system and application folders.
>
The following graphic illustrates how data flows throughout the system+
8. The inde".php serves as the front controller# initialiEing the base resources needed to run CodeIgniter. ;. The Router e"amines the 1TT0 re%uest to determine what should be done with it. >. If a cache file e"ists# it is sent directly to the browser# bypassing the normal system e"ecution. 2. Security. *efore the application controller is loaded# the 1TT0 re%uest and any user submitted data is filtered for security. 3. The Controller loads the model# core libraries# plugins# helpers# and any other resources needed to process the specific re%uest. F. The finaliEed -iew is rendered then sent to the web browser to be seen. If caching is enabled# the view is cached first so that on subse%uent re%uests it can be served.
)imitations
The first ma4or issue with the framewor! is how it deals with retrieving and manipulating data from the database. CodeIgniter's models are optional and serve no function other than code separation. There's no integrated CR/D and its :Active Record: class is really 4ust an alternative S5) synta". It also doesn't support table associations. So# you will be building many large %ueries essentially from scratch. CodeIgniter lac!s some essential libraries that are needed in most applications (i.e. Authentication and AC) . 9ou will need to rely on >rd party libraries in many of your applications. Since CodeIgniter lac!s much of the automation# there are no strict conventions to follow. This ma!es CodeIgniter a more fle"ible framewor!. @urthermore# its lac! of features and automation do give it an advantage when it comes to speed. Improving these limitations would give a great boost to the CodeIgniter framewor! and ma!e it more powerful. Although some of the limitations are fi"ed via > rd 0arty libraries or plugins it would be great to have them right out of the bo".
*ibliography
GGG# http+==codeigniter.com=wi!i=Tutorials= David /pton# Codeigniter for rapid php application development# 0ac!t 0ublishing ;HHI Thomas ,yer# 0rofessional CodeIgniter# &ro" ;HHJ