Yii Framework - Do we really need another php framework?


Published on

The Yii Framework is a professional and comprehensive PHP MVC framework. This presentation gives a short overview over the coolest features (from my perspective).

Published in: Technology
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Yii Framework - Do we really need another php framework?

  1. 1. Do we really need another PHP Framework?
  2. 2. About MeProfessionally developing software since 2003Focus on web, mobile and game developmentInto the gaming industry since 2008Former Lead developer – Web Games @GameforgeNow gun for hire: Eckert Internet Services
  3. 3. Yii?Yii is an acronym for „Yes it is!“, the answer to the most likely asked questions regarding a framework:Is it fast?Is it secure?Is it professional?Is it right for my next project?Pretty self-confident, hm?
  4. 4. Yiiwhat?Started in 2008 by former PRADO developer Qianq XueTeam of 7 core developersNo release for some months but active maintenance on GithubFacebook page & Google GroupSmall but professional community
  5. 5. Features at a glanceRAD Widgets (View helpers, ListView, GridView)AR, DAO, Query Builder, Database MigrationMassive Extensibility (DI, Behaviours, Events, Hooks, Modules …) => Useful Extensions!Nice RoutingGood security mechanismsScaffolding and Console Applicationslean, clean, reusable code
  6. 6. RAD WidgetsEasy menuGridView of (model)data Configurable in detail, or use as is!
  7. 7. RAD Widgets IIInstead of stand-alone widgets there are also widgets that work on your HTML
  8. 8. Active RecordWork with your database in an object oriented fashion
  9. 9. Active Record IIYiis AR is quite sophisticated!
  10. 10. Active Record – RelationsRelations are easy-peasy
  11. 11. Active Record – ScopesDefine WYG (What you get)
  12. 12. Active Record – BehaviorsDefine how it acts!
  13. 13. So Active Record is the holy grail!Active Record is convenientBUT: DO NOT use AR on data driven tables (like logs or tables where the throughput is high!)Every row is reflected as an objectThink!If the usecase doesnt favour AR, use DAO!Power <=> Responsibility
  14. 14. Data Access ObjectsUse it if you need lots of datasets at once.
  15. 15. Conclusion AR vs. DAOAR is convenient to useMost widgets support AR (but also DAO in some ways)Code generation through GiiIf you have tables where lots of records are accessed at once, use DAO!Dont stop to think because its easy to work with!
  16. 16. HooksEvery CComponent (almost everything in Yii) calls hooks before/after specified actions:beforeValidate/afterValidatebeforeSave/afterSavebeforeDelete/afterDeletebeforeFind/afterFindbeforeRender/afterRender… uncomplete list, also fired as events. Need to react? Just hook in!
  17. 17. Again: Think!Hooks and Events can trigger many actions without caring about them (Observer Pattern). So react on them wisely! e.g. User registers: Action to send mail to user is triggered Action to send mail to admin is triggered Creating a user profile Generating a pdf invoice is triggered ...
  18. 18. Security - XSSJust use the proper Widgets and methods:
  19. 19. Security - XSRFActivate XSRF tokenUse POST requests for important actions (like deleting, adding etc.) Thats all you need to do!
  20. 20. Extensions / ModulesModules are self-contained MVCs and nestableCan interact with core application. Nice for administrative frontend, JSON webservice etc.Lots of useful extensions already available
  21. 21. Console ApplicationsMost likely: CronjobsImplement in a MVC like fashionFriendly console:
  22. 22. Embedded Console ApplicationsGenerate message files from application (l8n)Generate new app skeletonMigrate database command… and some shell commands (code gen.)
  23. 23. And more...Easy Internationalization / LocalisationACL / RBAC (lots of options and possibilities)Caching on certain levelsPHP-Unit / Selenium SupportAlmost ALL Core Components are replacable by DI (Request, Session, Cookie, …) => maximum flexibility
  24. 24. Do we really need another PHP Framework? E S ! Y
  25. 25. Questions?????
  26. 26. Thank you!@nerdlibfront https://www.xing.com/profile/Joachim_Eckert www.eisit.de eckert@eisit.de