0% found this document useful (0 votes)
59 views44 pages

Codeigniter Loves You

The document discusses the CodeIgniter PHP web framework. It provides an overview of CodeIgniter, describing its MVC architecture and how it aims to simplify development through standard conventions and bundled libraries. It highlights some key features, such as the minimal configuration needed, form validation and input libraries, and integration with Doctrine. The document also covers CodeIgniter's documentation resources, active user community, and support channels.

Uploaded by

Lorena Busso
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
59 views44 pages

Codeigniter Loves You

The document discusses the CodeIgniter PHP web framework. It provides an overview of CodeIgniter, describing its MVC architecture and how it aims to simplify development through standard conventions and bundled libraries. It highlights some key features, such as the minimal configuration needed, form validation and input libraries, and integration with Doctrine. The document also covers CodeIgniter's documentation resources, active user community, and support channels.

Uploaded by

Lorena Busso
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 44

CODEIGNITER LOVES YOU

An Introduction to this Friendly Framework

Wednesday, January 13, 2010

Frameworks are awesome


Model/View/Controller is a design pattern to separate out function from output and abstract data sources. Many popular PHP frameworks use the model including the Zend Framework, CakePHP and CodeIgniter

Controller View Model

Wednesday, January 13, 2010

Why frameworks anyway?

Wednesday, January 13, 2010

Why frameworks anyway?


Simplify the small stu

Wednesday, January 13, 2010

Why frameworks anyway?


Simplify the small stu Standardized structure

Wednesday, January 13, 2010

Why frameworks anyway?


Simplify the small stu Standardized structure Promotes good coding standards (and healthy code)

Wednesday, January 13, 2010

Why frameworks anyway?


Simplify the small stu Standardized structure Promotes good coding standards (and healthy code) Speed!

Wednesday, January 13, 2010

Why frameworks anyway?


Simplify the small stu Standardized structure Promotes good coding standards (and healthy code) Speed! Interoperability

Wednesday, January 13, 2010

Frameworks are the answer


(except when theyre not)

Wednesday, January 13, 2010

Frameworks are the answer


(except when theyre not)
Not worth the overhead

Wednesday, January 13, 2010

Frameworks are the answer


(except when theyre not)
Not worth the overhead Might just need the parts (Zend Framework)

Wednesday, January 13, 2010

Frameworks are the answer


(except when theyre not)
Not worth the overhead Might just need the parts (Zend Framework) Like it or not, procedural is here to stay

Wednesday, January 13, 2010

Who is EllisLab?
CodeIgniter ExpressionEngine ExpressionHosting

Wednesday, January 13, 2010

CodeIgniter
CodeIgniter is an Application Development Framework a toolkit - for people who build web sites using PHP. Its goal is to enable you to develop projects much faster than you could if you were 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. CodeIgniter lets you creatively focus on your project by minimizing the amount of code needed for a given task.
Source: CodeIgniter.com Manual

Wednesday, January 13, 2010

What is CodeIgniter?
(a framework, duh)

Wednesday, January 13, 2010

What is CodeIgniter?
(a framework, duh)

Simplicity is king

Wednesday, January 13, 2010

What is CodeIgniter?
(a framework, duh)

Simplicity is king A real framework (not like those Zenders)

Wednesday, January 13, 2010

What is CodeIgniter?
(a framework, duh)

Simplicity is king A real framework (not like those Zenders) Tiny

Wednesday, January 13, 2010

What is CodeIgniter?
(a framework, duh)

Simplicity is king A real framework (not like those Zenders) Tiny Light

Wednesday, January 13, 2010

What is CodeIgniter?
(a framework, duh)

Simplicity is king A real framework (not like those Zenders) Tiny Light ...and, oh yeah, simple

Wednesday, January 13, 2010

Just how Small?


30 22.5 15 7.5 0 CodeIgniter Symfony Zend Framework CakePHP Solar Lithium

Zend Framework above is minimal install, the others huge. Prados just as bad...
Wednesday, January 13, 2010

Naming Conventions
Controllers
In the le: /system/application/controllers/blog.php
<?php class Blog extends Controller { function Blog(){ parent::Controller(); } function index($id){ //Im called by default! //$id is from URL - /site/blog/1 } } ?>

Wednesday, January 13, 2010

Naming Conventions
Models
In the le: /system/application/models/blog_model.php
<?php class Blog_model extends Model { function Blog_model(){ parent::Model(); } function getBlogEntries($id){ $this->db->get_where(blog,array(ID=>$id)); } } ?>

Wednesday, January 13, 2010

Naming Conventions
Libraries
In the le: /system/application/libraries/Defensio.php
<?php class Defensio { private $_conn = null; function Defensio(){ } function checkSpam($data){ $this->_conn->open(); } } ?>

Wednesday, January 13, 2010

Naming Conventions
Helpers
In the le: /system/application/helpers/blog_helper.php

<?php function lookup_author($aid){ } function format_posted_date($date){ } ?>

Wednesday, January 13, 2010

Setting Up

Wednesday, January 13, 2010

Setting Up
Almost no conguration

Wednesday, January 13, 2010

Setting Up
Almost no conguration PHP4 Support

Wednesday, January 13, 2010

Setting Up
Almost no conguration PHP4 Support No default templating

Wednesday, January 13, 2010

Setting Up
Almost no conguration PHP4 Support No default templating Bundled Libraries

Wednesday, January 13, 2010

Conguration
Make changes to the cong.php le
hostname

Make changes to the database.php le


connection information

Make changes to the routes.php le


Change default controller

Wednesday, January 13, 2010

Whats in the Box

Wednesday, January 13, 2010

Community

Wednesday, January 13, 2010

Community
Great documentation (included)

Wednesday, January 13, 2010

Community
Great documentation (included) Active forums

Wednesday, January 13, 2010

Community
Great documentation (included) Active forums IRC channel (Freenode)

Wednesday, January 13, 2010

Community
Great documentation (included) Active forums IRC channel (Freenode) User support

Wednesday, January 13, 2010

Community
Great documentation (included) Active forums IRC channel (Freenode) User support Community Wiki

Wednesday, January 13, 2010

Library Spotlight:
Form/Validation
Form Helper
Easily create forms - just echo Simple interface for simple or detailed cong The usual suspects

Validation Library
Set up rules and elds Rules include: required, alpha_numeric, valid_email, valid_ip Callbacks

Wednesday, January 13, 2010

Library Spotlight:
Form/Validation
<?php class Blog extends Controller { function Blog(){ parent::Controller(); } function index($id){ $this->load->library(validation); $rules=array( title=>required ); $fields=array( title=>Title ); $this->validation->set_fields($fields); $this->validation->set_rules($rules); if($this->validation->run()!=FALSE){ echo success!; } } ?> }

Wednesday, January 13, 2010

Library Spotlight:
Loader
Included by default Methods for major types:
$this->load->model(my_model); $this->load->library(mylib); $this->load->view(myview);

Named correctly? Loader is your best friend


$this->load->model(blog_post_model); $this->blog_post_model->foo(); $this->load->model(blog_post_model,bpm); $this->bpm->bar();
Wednesday, January 13, 2010

Library Spotlight:
Input/Security
XSS ltering Security ltering
GET all globals lters POST/COOKIE on array key Only \n for newlines

Wednesday, January 13, 2010

Library Spotlight:
Doctrine Integration
Make changes to the database.php le
create DSN set up paths and autoloader create the Doctrine connection make command line interface make Doctrine directories (xtures, migrations, etc.)

All standard commands available with CLI Extend Doctrine_Record & Doctrine_Table
Wednesday, January 13, 2010

Credits/Contact
Chris Cornutt
[email protected]

Leave me some feedback! http://joind.in/talk/view/1254


Photo credit: Nicholas Smale - Urbis Blocks

Now...who wants some code?


Wednesday, January 13, 2010

You might also like