The Yii Framework is a professional and comprehensive PHP MVC framework. This presentation gives a short overview over the coolest features (from my perspective).
2. About Me
Professionally developing software since 2003
Focus on web, mobile and game development
Into the gaming industry since 2008
Former Lead developer – Web Games @
Gameforge
Now gun for hire: Eckert Internet Services
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. Yiiwhat?
Started in 2008 by former PRADO developer
Qianq Xue
Team of 7 core developers
No release for some months but active
maintenance on Github
Facebook page & Google Group
Small but professional community
5. Features at a glance
RAD Widgets (View helpers, ListView, GridView)
AR, DAO, Query Builder, Database Migration
Massive Extensibility (DI, Behaviours, Events, Hooks,
Modules …) => Useful Extensions!
Nice Routing
Good security mechanisms
Scaffolding and Console Applications
lean, clean, reusable code
13. So Active Record is the holy grail!
Active Record is convenient
BUT: DO NOT use AR on data driven tables (like
logs or tables where the throughput is high!)
Every row is reflected as an object
Think!
If the usecase doesn't favour AR, use DAO!
Power <=> Responsibility
15. Conclusion AR vs. DAO
AR is convenient to use
Most widgets support AR (but also DAO in some
ways)
Code generation through Gii
If you have tables where lots of records are
accessed at once, use DAO!
Don't stop to think because it's easy to work
with!
16. Hooks
Every CComponent (almost everything in Yii)
calls hooks before/after specified actions:
beforeValidate/afterValidate
beforeSave/afterSave
beforeDelete/afterDelete
beforeFind/afterFind
beforeRender/afterRender
… uncomplete list, also fired as events.
Need to react? Just hook in!
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
...
19. Security - XSRF
Activate XSRF token
Use POST requests for important actions
(like deleting, adding etc.)
That's all you need to do!
20. Extensions / Modules
Modules are self-contained MVCs and nestable
Can interact with core application. Nice for
administrative frontend, JSON webservice etc.
Lots of useful extensions already available
22. Embedded Console Applications
Generate message files from application (l8n)
Generate new app skeleton
Migrate database command
… and some shell commands (code gen.)
23. And more...
Easy Internationalization / Localisation
ACL / RBAC (lots of options and possibilities)
Caching on certain levels
PHP-Unit / Selenium Support
Almost ALL Core Components are replacable by
DI (Request, Session, Cookie, …)
=> maximum flexibility
24. Do we really need another
PHP Framework?
E S !
Y