benefits of the codeigniter framework
DESCRIPTION
Toby Beresford's slides from the PHP London Conference 08 on CodeIgniter - part of a comparison with Zend and SymfonyTRANSCRIPT
![Page 2: Benefits of the CodeIgniter Framework](https://reader033.vdocuments.site/reader033/viewer/2022061210/54917c1cb479599d2d8b5318/html5/thumbnails/2.jpg)
Content
• Bio• Benefits• Why Frameworks• MVC• Demo• Links
![Page 3: Benefits of the CodeIgniter Framework](https://reader033.vdocuments.site/reader033/viewer/2022061210/54917c1cb479599d2d8b5318/html5/thumbnails/3.jpg)
Toby Bio• 12 years – professional Web App Development
• 5 years - Lotus Domino• 7 years – PHP• 8 months - CodeIgniter
• Toby Beresford Applications Ltd
• Platform applications• Facebook• Bebo, Myspace et al.
• Clients• Sky News, Last.fm, Comic Relief, VideoJug, AfffiliateWindow, .name registry….
• [email protected] / www.tobyberesford.com
• h www.facebook.com/pages/Toby-Beresford-Applications/6164004474
![Page 4: Benefits of the CodeIgniter Framework](https://reader033.vdocuments.site/reader033/viewer/2022061210/54917c1cb479599d2d8b5318/html5/thumbnails/4.jpg)
Benefits of CI• Small
• Fast
• Simple
• Customer ready– a sys admin can install the CI framework in a few minutes– great documentation means easy hand over: new developers just learn the
framework not your home grown MVC code
• Great for mash-up apps using multiple platforms – eg. Facebook apps
• Cleaner code
![Page 5: Benefits of the CodeIgniter Framework](https://reader033.vdocuments.site/reader033/viewer/2022061210/54917c1cb479599d2d8b5318/html5/thumbnails/5.jpg)
Why FrameworksNo framework
Framework
Me and my framework
Framework
Platform API
Me, my framework anda Platform API
![Page 6: Benefits of the CodeIgniter Framework](https://reader033.vdocuments.site/reader033/viewer/2022061210/54917c1cb479599d2d8b5318/html5/thumbnails/6.jpg)
MVCView (views/frog_count.php)
<html><body>
<h1> You’ve <?=$froggies;?> items in list</h1></body>
</html>
Controller (controllers/my_controller.php)function total_frogs () {
$this->load->model(“frogs”);$number_of_frogs = $this->frogs->count_frogs();$data[‘froggies’] = $number_of_frogs;$this->load->view(“frog_view”, $data);
}
Model (models/frogs.php)function count_frogs() {
$this->db->where(“type”,”frog”);$this->db->from(“animals”);$query = $this->db->get();Return $query->num_rows();}
Model
View
Controller
![Page 7: Benefits of the CodeIgniter Framework](https://reader033.vdocuments.site/reader033/viewer/2022061210/54917c1cb479599d2d8b5318/html5/thumbnails/7.jpg)
How to run a CI method• http://www.my_server.com/index.php/my_controller/my_frogs
Where you’ve installed CI
Your main controller file:System/application/controllers/my_controller.php
The name of a method in your controller
![Page 8: Benefits of the CodeIgniter Framework](https://reader033.vdocuments.site/reader033/viewer/2022061210/54917c1cb479599d2d8b5318/html5/thumbnails/8.jpg)
Download from www.codeigniter.com
![Page 9: Benefits of the CodeIgniter Framework](https://reader033.vdocuments.site/reader033/viewer/2022061210/54917c1cb479599d2d8b5318/html5/thumbnails/9.jpg)
Upload to your server
![Page 10: Benefits of the CodeIgniter Framework](https://reader033.vdocuments.site/reader033/viewer/2022061210/54917c1cb479599d2d8b5318/html5/thumbnails/10.jpg)
See the welcome screen
![Page 11: Benefits of the CodeIgniter Framework](https://reader033.vdocuments.site/reader033/viewer/2022061210/54917c1cb479599d2d8b5318/html5/thumbnails/11.jpg)
Create your database
![Page 12: Benefits of the CodeIgniter Framework](https://reader033.vdocuments.site/reader033/viewer/2022061210/54917c1cb479599d2d8b5318/html5/thumbnails/12.jpg)
Configure CodeIgniter Base URL
![Page 13: Benefits of the CodeIgniter Framework](https://reader033.vdocuments.site/reader033/viewer/2022061210/54917c1cb479599d2d8b5318/html5/thumbnails/13.jpg)
Configure Database Connection
![Page 14: Benefits of the CodeIgniter Framework](https://reader033.vdocuments.site/reader033/viewer/2022061210/54917c1cb479599d2d8b5318/html5/thumbnails/14.jpg)
Create a controller
![Page 15: Benefits of the CodeIgniter Framework](https://reader033.vdocuments.site/reader033/viewer/2022061210/54917c1cb479599d2d8b5318/html5/thumbnails/15.jpg)
Add the view
![Page 16: Benefits of the CodeIgniter Framework](https://reader033.vdocuments.site/reader033/viewer/2022061210/54917c1cb479599d2d8b5318/html5/thumbnails/16.jpg)
Try it
![Page 17: Benefits of the CodeIgniter Framework](https://reader033.vdocuments.site/reader033/viewer/2022061210/54917c1cb479599d2d8b5318/html5/thumbnails/17.jpg)
Send variables to the view via an array
VIEW
CONTROLLER
![Page 18: Benefits of the CodeIgniter Framework](https://reader033.vdocuments.site/reader033/viewer/2022061210/54917c1cb479599d2d8b5318/html5/thumbnails/18.jpg)
And…
![Page 19: Benefits of the CodeIgniter Framework](https://reader033.vdocuments.site/reader033/viewer/2022061210/54917c1cb479599d2d8b5318/html5/thumbnails/19.jpg)
Model: Get item
• Uses ActiveRecord
![Page 20: Benefits of the CodeIgniter Framework](https://reader033.vdocuments.site/reader033/viewer/2022061210/54917c1cb479599d2d8b5318/html5/thumbnails/20.jpg)
Model: Put Item
![Page 21: Benefits of the CodeIgniter Framework](https://reader033.vdocuments.site/reader033/viewer/2022061210/54917c1cb479599d2d8b5318/html5/thumbnails/21.jpg)
Model: Get all
![Page 22: Benefits of the CodeIgniter Framework](https://reader033.vdocuments.site/reader033/viewer/2022061210/54917c1cb479599d2d8b5318/html5/thumbnails/22.jpg)
Model: Delete Item
![Page 23: Benefits of the CodeIgniter Framework](https://reader033.vdocuments.site/reader033/viewer/2022061210/54917c1cb479599d2d8b5318/html5/thumbnails/23.jpg)
Controller: Add
![Page 24: Benefits of the CodeIgniter Framework](https://reader033.vdocuments.site/reader033/viewer/2022061210/54917c1cb479599d2d8b5318/html5/thumbnails/24.jpg)
View: Add/Edit
![Page 25: Benefits of the CodeIgniter Framework](https://reader033.vdocuments.site/reader033/viewer/2022061210/54917c1cb479599d2d8b5318/html5/thumbnails/25.jpg)
User Interface: Add
![Page 26: Benefits of the CodeIgniter Framework](https://reader033.vdocuments.site/reader033/viewer/2022061210/54917c1cb479599d2d8b5318/html5/thumbnails/26.jpg)
Controller: Save
![Page 27: Benefits of the CodeIgniter Framework](https://reader033.vdocuments.site/reader033/viewer/2022061210/54917c1cb479599d2d8b5318/html5/thumbnails/27.jpg)
Controller: Edit
![Page 28: Benefits of the CodeIgniter Framework](https://reader033.vdocuments.site/reader033/viewer/2022061210/54917c1cb479599d2d8b5318/html5/thumbnails/28.jpg)
User Interface: Edit
![Page 29: Benefits of the CodeIgniter Framework](https://reader033.vdocuments.site/reader033/viewer/2022061210/54917c1cb479599d2d8b5318/html5/thumbnails/29.jpg)
Controller: List all
![Page 30: Benefits of the CodeIgniter Framework](https://reader033.vdocuments.site/reader033/viewer/2022061210/54917c1cb479599d2d8b5318/html5/thumbnails/30.jpg)
Views: List
• Note we can use ordinary PHP in the views, no template language to learn
![Page 31: Benefits of the CodeIgniter Framework](https://reader033.vdocuments.site/reader033/viewer/2022061210/54917c1cb479599d2d8b5318/html5/thumbnails/31.jpg)
User Interface: List
![Page 32: Benefits of the CodeIgniter Framework](https://reader033.vdocuments.site/reader033/viewer/2022061210/54917c1cb479599d2d8b5318/html5/thumbnails/32.jpg)
Class Libraries and HelpersHelper ReferenceArray Helper Cookie Helper Date Helper Directory Helper Download Helper Email Helper File Helper Form Helper HTML Helper Inflector Helper Path Helper Security Helper Smiley Helper String Helper Text Helper Typography Helper URL Helper XML Helper
Class ReferenceBenchmarking Class Calendaring Class Config Class Database Class Email Class Encryption Class File Uploading Class FTP Class HTML Table Class Image Manipulation Class Input and Security Class Loader Class Language Class Output Class
Pagination Class Session Class Trackback Class Template Parser Class Unit Testing Class URI Class User Agent Class Validation Class XML-RPC Class Zip Encoding Class
![Page 33: Benefits of the CodeIgniter Framework](https://reader033.vdocuments.site/reader033/viewer/2022061210/54917c1cb479599d2d8b5318/html5/thumbnails/33.jpg)
Summary
• CI is fast to run, light to deploy and easy to learn
• Great for mash-up applications in the platform world– Wishlist = Eg. AffiliateWindow retailer list API,
product API, Facebook UI, Facebook User tables, + PayPal mass pay for commissions
![Page 34: Benefits of the CodeIgniter Framework](https://reader033.vdocuments.site/reader033/viewer/2022061210/54917c1cb479599d2d8b5318/html5/thumbnails/34.jpg)
Useful links• www.codeigniter.com– User manual, community forums, releases
• www.kohanaphp.com – PHP5 CodeIgniter fork
• www.phpframeworks.info – All the frameworks side by side
• www.people4web2.com– Contractor site with a skills category for the
major PHP Frameworks• LondonGarage06.eventbrite.com– Facebook Developer Garage – 5th March
• Questions? – [email protected]