codeigniter loves you

Upload: lorena-busso

Post on 14-Apr-2018

221 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/30/2019 Codeigniter Loves You

    1/44

    CODEIGNITER LOVESYOU

    An Introduction to thisFriendly Framework

    Wednesday, January 13, 2010

  • 7/30/2019 Codeigniter Loves You

    2/44

    Frameworks are awesome

    Controller

    Model

    View

    Model/View/Controller is adesign pattern to separate out

    function from output and

    abstract data sources.

    Many popular PHP frameworksuse the model including the

    Zend Framework, CakePHP andCodeIgniter

    Wednesday, January 13, 2010

  • 7/30/2019 Codeigniter Loves You

    3/44

    Why frameworks anyway?

    Wednesday, January 13, 2010

  • 7/30/2019 Codeigniter Loves You

    4/44

    Why frameworks anyway?

    Simplify the small stuff

    Wednesday, January 13, 2010

  • 7/30/2019 Codeigniter Loves You

    5/44

    Why frameworks anyway?

    Simplify the small stuff

    Standardized structure

    Wednesday, January 13, 2010

  • 7/30/2019 Codeigniter Loves You

    6/44

    Why frameworks anyway?

    Simplify the small stuff

    Standardized structurePromotes good coding standards (and healthy code)

    Wednesday, January 13, 2010

  • 7/30/2019 Codeigniter Loves You

    7/44

    Why frameworks anyway?

    Simplify the small stuff

    Standardized structurePromotes good coding standards (and healthy code)

    Speed!

    Wednesday, January 13, 2010

  • 7/30/2019 Codeigniter Loves You

    8/44

    Why frameworks anyway?

    Simplify the small stuff

    Standardized structurePromotes good coding standards (and healthy code)

    Speed!

    Interoperability

    Wednesday, January 13, 2010

  • 7/30/2019 Codeigniter Loves You

    9/44

    Frameworks are the answer

    (except when theyre not)

    Wednesday, January 13, 2010

  • 7/30/2019 Codeigniter Loves You

    10/44

    Frameworks are the answer

    (except when theyre not)

    Not worth the overhead

    Wednesday, January 13, 2010

  • 7/30/2019 Codeigniter Loves You

    11/44

    Frameworks are the answer

    (except when theyre not)

    Not worth the overhead

    Might just need the parts (Zend Framework)

    Wednesday, January 13, 2010

  • 7/30/2019 Codeigniter Loves You

    12/44

    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

  • 7/30/2019 Codeigniter Loves You

    13/44

    Who is EllisLab?

    CodeIgniter

    ExpressionEngine

    ExpressionHosting

    Wednesday, January 13, 2010

  • 7/30/2019 Codeigniter Loves You

    14/44

    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 thanyou could if you were writing code from scratch, byproviding a rich set of libraries for commonly needed

    tasks, as well as a simple interface and logical structure toaccess these libraries. CodeIgniter lets you creatively focuson your project by minimizing the amount of code needed

    for a given task.

    Source: CodeIgniter.com Manual

    Wednesday, January 13, 2010

  • 7/30/2019 Codeigniter Loves You

    15/44

    What is CodeIgniter?(a framework, duh)

    Wednesday, January 13, 2010

  • 7/30/2019 Codeigniter Loves You

    16/44

    What is CodeIgniter?(a framework, duh)

    Simplicity is king

    Wednesday, January 13, 2010

  • 7/30/2019 Codeigniter Loves You

    17/44

    What is CodeIgniter?(a framework, duh)

    Simplicity is king

    A real framework (not like those Zenders)

    Wednesday, January 13, 2010

  • 7/30/2019 Codeigniter Loves You

    18/44

    What is CodeIgniter?(a framework, duh)

    Simplicity is king

    A real framework (not like those Zenders)

    Tiny

    Wednesday, January 13, 2010

  • 7/30/2019 Codeigniter Loves You

    19/44

    What is CodeIgniter?(a framework, duh)

    Simplicity is king

    A real framework (not like those Zenders)

    Tiny

    Light

    Wednesday, January 13, 2010

  • 7/30/2019 Codeigniter Loves You

    20/44

    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

  • 7/30/2019 Codeigniter Loves You

    21/44

    Just how Small?

    0

    7.5

    15

    22.5

    30CodeIgniter

    Symfony

    Zend FrameworkCakePHP

    Solar

    Lithium

    Zend Framework above is minimal install, the others huge.

    Prados just as bad...

    Wednesday, January 13, 2010

  • 7/30/2019 Codeigniter Loves You

    22/44

    Naming ConventionsControllers

    In the file: /system/application/controllers/blog.php

    Wednesday, January 13, 2010

  • 7/30/2019 Codeigniter Loves You

    23/44

    Naming ConventionsModels

    In the file: /system/application/models/blog_model.php

    Wednesday, January 13, 2010

  • 7/30/2019 Codeigniter Loves You

    24/44

    Naming ConventionsLibraries

    In the file: /system/application/libraries/Defensio.php

    Wednesday, January 13, 2010

  • 7/30/2019 Codeigniter Loves You

    25/44

    Naming ConventionsHelpers

    In the file: /system/application/helpers/blog_helper.php

    Wednesday, January 13, 2010

  • 7/30/2019 Codeigniter Loves You

    26/44

    Setting Up

    Wednesday, January 13, 2010

  • 7/30/2019 Codeigniter Loves You

    27/44

    Setting Up

    Almost no configuration

    Wednesday, January 13, 2010

  • 7/30/2019 Codeigniter Loves You

    28/44

    Setting Up

    Almost no configuration

    PHP4 Support

    Wednesday, January 13, 2010

  • 7/30/2019 Codeigniter Loves You

    29/44

    Setting Up

    Almost no configuration

    PHP4 SupportNo default templating

    Wednesday, January 13, 2010

  • 7/30/2019 Codeigniter Loves You

    30/44

    Setting Up

    Almost no configuration

    PHP4 SupportNo default templating

    Bundled Libraries

    Wednesday, January 13, 2010

  • 7/30/2019 Codeigniter Loves You

    31/44

    Configuration

    Make changes to the config.php file

    hostname

    Make changes to the database.php file

    connection information

    Make changes to the routes.php file

    Change default controller

    Wednesday, January 13, 2010

  • 7/30/2019 Codeigniter Loves You

    32/44

    Whats in the Box

    Wednesday, January 13, 2010

  • 7/30/2019 Codeigniter Loves You

    33/44

    Community

    Wednesday, January 13, 2010

  • 7/30/2019 Codeigniter Loves You

    34/44

    Community

    Great documentation (included)

    Wednesday, January 13, 2010

  • 7/30/2019 Codeigniter Loves You

    35/44

    Community

    Great documentation (included)

    Active forums

    Wednesday, January 13, 2010

  • 7/30/2019 Codeigniter Loves You

    36/44

    Community

    Great documentation (included)

    Active forums

    IRC channel (Freenode)

    Wednesday, January 13, 2010

  • 7/30/2019 Codeigniter Loves You

    37/44

    Community

    Great documentation (included)

    Active forums

    IRC channel (Freenode)

    User support

    Wednesday, January 13, 2010

  • 7/30/2019 Codeigniter Loves You

    38/44

    Community

    Great documentation (included)

    Active forums

    IRC channel (Freenode)

    User support

    Community Wiki

    Wednesday, January 13, 2010

  • 7/30/2019 Codeigniter Loves You

    39/44

    Library Spotlight:

    Form/ValidationForm Helper

    Easily create forms - just echo

    Simple interface for simple or detailed config

    The usual suspects

    Validation Library

    Set up rules and fieldsRules include: required, alpha_numeric, valid_email, valid_ip

    Callbacks

    Wednesday, January 13, 2010

  • 7/30/2019 Codeigniter Loves You

    40/44

    Library Spotlight:

    Form/Validation

    Wednesday, January 13, 2010

  • 7/30/2019 Codeigniter Loves You

    41/44

    Library Spotlight:

    LoaderIncluded 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

  • 7/30/2019 Codeigniter Loves You

    42/44

    Library Spotlight:

    Input/SecurityXSS filtering

    Security filteringGET

    all globals

    filters POST/COOKIE on array key

    Only \n for newlines

    Wednesday, January 13, 2010

  • 7/30/2019 Codeigniter Loves You

    43/44

    Library Spotlight:

    Doctrine IntegrationMake changes to the database.php file

    create DSN

    set up paths and autoloader

    create the Doctrine connection

    make command line interface

    make Doctrine directories (fixtures, migrations, etc.)All standard commands available with CLI

    Extend Doctrine_Record & Doctrine_Table

    Wednesday, January 13, 2010

  • 7/30/2019 Codeigniter Loves You

    44/44

    Credits/Contact

    Photo credit: Nicholas Smale - Urbis Blocks

    Chris [email protected]

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

    Now who wants some code?

    http://joind.in/talk/view/1254http://joind.in/talk/view/1254mailto:[email protected]:[email protected]