Upgrade to Pro — share decks privately, control downloads, hide ads and more …

CodeIgniter Lab

CodeIgniter Lab

CodeIgniter Lab
http://leonguyen.com

LeoNguyen.com

July 11, 2013
Tweet

More Decks by LeoNguyen.com

Other Decks in Programming

Transcript

  1. Outline - References (http://bit.ly/1fofKSV) - Lab 01: Introduction CodeIgniter 2.1.3

    - Lab 02: HMVC - Lab 03: Grocery CRUD 1.3.3 - Lab 04: Eden Library 3.1 - Lab 05: Doctrine 2
  2. Task 1 - Download CI - Goto CI download site

    http://ellislab.com/codeigniter/user- guide/installation/downloads.html
  3. Task 3 - Download & install Sublime Text - Goto

    Sublime Text download site http://www.sublimetext.com
  4. Task 1 - Create Helloworld controller - Copy Welcome controller,

    enter the following code then goto http: //localhost/cilab/index.php/helloworld
  5. Task 2 - Create .htaccess - Create .htaccess in root

    source files then enter the following code: https://gist.github.com/leonguyen/5251416
  6. Task 3 - Config config.php - Remove 'index.php' of 'index_page'.

    - Enter 'QUERY_STRING' of 'uri_protocol'.
  7. HMVC (cont) - Modularization: Reduction of dependencies between the disparate

    parts of the application. - Organization: Having a folder for each of the relevant triads makes for a lighter work load. - Reusability: By nature of the design it is easy to reuse nearly every piece of code. - Extendibility: Makes the application more extensible without sacrificing ease of maintenance.
  8. Task 2: Create 'Foo' controller - Create 'Foo' controller extends

    'MX_Controller': https://gist.github.com/leonguyen/5326355
  9. Intro - Grocery CRUD is a library that makes a

    developer's life easier. Just few lines of code and you can create a full stable CRUD with nice views. A totally automatic system that even a newbie in PHP can work with.
  10. Intro - Eden is a PHP library designed for rapid

    prototyping, with less code. Yes, Really. - Eden simply a set of reusable components, that works with any PHP framework and CMS. Eden makes code logical and readable with dead simple syntax.
  11. Task 2: Installation - Unzip 'eden.zip' and copy all files

    to 'libraries' folder of your CI project.
  12. Task 3: Create example controller - Create 'edenhellow.php' controller and

    enter code: https://gist.github. com/leonguyen/5915315
  13. Task 4: Run - Enter the url http://localhost/CILab/edenhello/ on the

    browser. Note: You have access to a server with at least PHP 5.3.x
  14. Intro - Doctrine is a very powerful ORM in php

    and it is possible to easily integrate and use doctrine with codeigniter as ORM
  15. Task 1: Download - Go to github.com/doctrine and download +

    ORM: github.com/doctrine/doctrine2 + Common: github.com/doctrine/common + DBAL: github.com/doctrine/dbal and Cache, Annotations, Lexer
  16. Task 2: Create Doctrine folder - Create ‘Doctrine’ folder into

    ‘application/libraries’ and put its files.
  17. Task 3: Create Doctrine bootstrap - Create ‘Doctrine.php’ into ‘application/libraries’

    folder. - Enter code: https://gist.github.com/leonguyen/6696118
  18. Task 6: Command Line Tool - Create ‘doctrine-cli.php’ into ‘application’

    folder. - Enter code: https://gist.github.com/leonguyen/6700705
  19. Task 7: Setup Entities, Proxies, and DB Schema - List

    of commands: php doctrine-cli.php (See: youtu.be/yFH5JcH-RtM) - Entity classes: php doctrine-cli.php orm:generate-entities models (See: youtu.be/nEMfBno40vE) - Proxy classes: php doctrine-cli.php orm:generate-proxies (See: youtu.be/v4J_cI5CJe0) - Drop tables: php doctrine-cli.php orm:schema-tool:drop --force (See: youtu.be/lhGWsFmCeoc) - Create tables: php doctrine-cli.php orm:schema-tool:create (See: youtu.be/MhLAi4f_mg4)