Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Intro to DooPHP

26,452 views

Published on

DooPHP slides for PHP Meetup 2011 Malaysia: Framework Shootout

for android version, visit http://doophp.com/files/intro-to-doophp.apk

special thanks to php.net.my

Published in: Technology
  • Are you there, Mr. Leng Sheng Hong? Have you released a new version of DooPHP since 1.4.1? Kind regards.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • its shown on slide 56. It is netbeans... :)
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • An interesting and easy to follow intro. Just a quick question, what IDE are you using? The screen shot on slide 22 looks lovely.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Intro to DooPHP

  1. 1. Who am I?Leng Sheng Hong• The author of DooPHP framework.• Had been a Malaysian for the last24 years (experienced)
  2. 2. What is DooPHP?
  3. 3. , how fast?Hmm
  4. 4. Definitely faster than KTM
  5. 5. Benchmark (needs an update) http://www.doophp.com/benchmark
  6. 6. Hmm, so is it fastbecause there’s nofeatures?
  7. 7. Features• Sophisticated URI routing • High Performance• RESTful out of the box • Database profiling tool• HMVC • i18n Internationalization• Authentication • Template engine• Authorization (ACL & RBAC) • PHP 5.3 Namespace support• Data caching • 100% E_STRICT compliant• Frontend caching • auto loading• Form generation & validation • Model class generation• Database ORM • CLI support• Database replication • new BSD license• Logging & Profiling tools • simple code & easy to extend
  8. 8. Hmm,Why not CakePHP orZend Framework or Symfonyor CodeIgniter or Zoop orAkelos or Yii or PHP on Traxor Prado or Seagull?
  9. 9. Because you have to chooseone, dammitPlus..
  10. 10. How to get started with DooPHP http://doophp.com/download
  11. 11. How to get started with DooPHPsvn checkout http://doophp.googlecode.com/svn/trunk/ doophp
  12. 12. Read the guide, api doc & blog http://doophp.com/docVisit the forum if you have questions & suggestions
  13. 13. Basic app structure
  14. 14. Basic app structure
  15. 15. With HMVC usage example module
  16. 16. DooPHP MVC Flow
  17. 17. How to start writing my app? 3 ways to write: • The manual way • The automated way • Hybrid
  18. 18. The manual way
  19. 19. Define routes
  20. 20. Create Controller & Action method
  21. 21. View rendering
  22. 22. Output Result
  23. 23. The automated way
  24. 24. What to automate? Auto routing no more defining in routes.conf.php Auto view rendering no need to specify a view to be rendered
  25. 25. Let’s do some tweaksAuto routing1. Remove the routes definition in routes.conf.php2. Set AUTOROUTE to true in common.conf.phpAuto view rendering1. Remove $this->renderc() in controller2. Set $autorender property to true in controller
  26. 26. Remove the routes definition in routes.conf.phpSet AUTOROUTE to true in common.conf.php
  27. 27. StoreController
  28. 28. TaDa! Same output result
  29. 29. What’s the difference?Manual way Gives you whole lot of manual controls, good news for ya’, control freaks! Auto way Save you all da’ tedious wok’! Good news for ya, lazy bump!
  30. 30. Hybrid? When?When you’re using auto routing BUT You want some freaking awesome URLs (for SEO purpose, maybe) You want to redirect some non-existent URLs. You want URLs for your users. http://twitty.com.my/leng And some weirdo situation you would never thought of...
  31. 31. Freaking awesome URL* You won’t be ranked number 1 in Google search that easily though
  32. 32. Redirect some URLs
  33. 33. URLs for your users. http://twitty.com.my/lengDoo this in routes.conf.phpDoo this in UserController
  34. 34. And for some weirdo situation youwould never thought of...
  35. 35. I have a controller
  36. 36. Client tends to mistype the URL‘transactions’ a lot. Now, hewanted to be able to accesspages via ‘transactions’ too *screw him
  37. 37. How to do it?
  38. 38. Easiest solution
  39. 39. Another use case for autoroute_aliasWhen you are using auto routing and want a URL structurewhich is deeper than the typicalhttp://domain/controller/method
  40. 40. Model & Database
  41. 41. Configure db.conf.php
  42. 42. Enable DB in index.php
  43. 43. Database example
  44. 44. Define table relationships (if needed)db.conf.php No naming convention required, works with any of your existing DBs.
  45. 45. Generate Models
  46. 46. Model usage example
  47. 47. Querying
  48. 48. Model usage example (extends DooModel)
  49. 49. Some list of methods in DooModel
  50. 50. What do you need other thanDooPHP ?
  51. 51. You need to get a life.
  52. 52. and Probably a good IDE.
  53. 53. NetBeans
  54. 54. Code hinting for DooPHP
  55. 55. Awesome for quick reference
  56. 56. Less is More. I should stop hereand let the Adventurers explore
  57. 57. Questions? Don’t worry, I won’t eat you http://twitter.com/doophp leng@doophp.com
  58. 58. Just Doo IT!

×