May 16, 2015
Kohana VS Yii
By Kemal Delalic ([email protected])
Kohana & VS Yii
Two different worlds.
Framework buzz
• 30+ modern PHP frameworks• Different approaches• Hard to choose• Even harder to follow
“Let’s fix what we have”
• EllisLabs’s slow development• Trying to improve CodeIgniter• Community rejection• BlueFlame
“Let’s make it better”
• PHP5• Independant• Faster development
Kohana 2
“Let’s make it much better”
• Complete rewrite• Keep it simple• No magic
Kohana 3
Kohana and I
• Used major frameworks for actual development before:Zend Framework, Symfony, CakePHP, CodeIgniter, etc.• Had to work on a Kohana 3.0.0.
project• “Man, this looks bad”
STRESS
• I have to install new PHP?• Why aren’t method names like in
Zend Framework?• Feels “limited”?• How to use this after ZF which is
so ... awesome and full of everything?• Where is the documentation?
REVELATION
PHP 5.2
Because it was already here.
Strict development and conventions.
Extremely strict.
Code is a symphony
and you feel like an artist writing it
Write your own code
instead of having it generated for you
No magic stuff
because nothing happens out of nowhere
DRY
You should never repeat yourself.
Speed
So fast that no one seems to benchmark against it.
Makes sense
Everything is isolated and in it’s place
Unit tested
Having something safe and tested can’t be bad.
The Core
Only what PHP misses natively
Full UTF-8 support
Because 6 isn’t coming soon
Cascading File System
You don’t know how much you always needed it.
Use Class, extend Kohana_Class
HMVC
(Hierarchical Model-View-Controller)
RFC 2616
Speaking of DRY
Routes help you
not to get lost
Profile
__(‘Internationalization’)
As easy as it can be
HelpersClasses like any others• Powerful toolset
– Arr– CLI– Cookie– Date– Debug– Encrypt– Feed– File– Form– Fragment (caching)– HTML
– I18n– Inflector– Log– Num– Security– Session– Text– Upload– URL– UTF8– Validation
Modularity
Force powered by CFS
Default modules
• Auth• Cache• Codebench• Database• Image• ORM• UnitTest• Userguide
Auth
• Provides basic tools for authentication• Driver support – file auth by default
Cache
• Driver support – all popular drivers• Very easy to use and change driver later
CodeBench
• Easy benchmarking interface on application level
Database
• Powerful object oriented interface• Multiple driver support, MySQL and PDO by
default
Image
• Provides extremely easy interface for image manipulation
• Feels like Photoshop
ORM
• ActiveRecord pattern• Respect and be respected (conventions)
Unittest
• Web interface for running all unit tests from a single place: app, modules, framework
Userguide
• All framework documentation in one place• Application’s API documented “on-the-fly”• Perfect for collaboration and new developers
arriving to the project
Community modules
• 500+ modules• Use Zend Framework or any other library as a
module• Obvious Kohanas’ affection on module
authors’ code quality
People behind Kohana
Small, yet very elite community
Rasmus Lerdorf
is well known for “hating” frameworks
Thank you
Please join the Kohana workshop