360 likes | 496 Views
PHP Framework “Battle”. Zakir Hemraj. Slides and code will be posted on the meetup group Video will be posted on: achievers.com/tech Tell your friends!. About Me. Dev Team Lead @ Achievers Professional Web Framework Experience: J2EE with Spring, Hibernate PHP with CodeIgniter
E N D
PHP Framework “Battle” Zakir Hemraj
Slides and code will be posted on the meetup group • Video will be posted on: achievers.com/tech • Tell your friends!
About Me • Dev Team Lead @ Achievers • Professional Web Framework Experience: • J2EE with Spring, Hibernate • PHP with CodeIgniter • Ruby on Rails • Not an expert in Zend Framework, CakePHP or Symfony
Goal • Give you “flavor” of a few frameworks • Share some scientific and subjective comparisons • Make you better equipped to compare and choose the right framework
What I’m not doing… • In-depth framework code walkthrough of all features and functions • Handing you a silver bullet
Agenda • Overview of frameworks • Review basic concepts • MVC, ORMs • The application • requirements, db schema • Code walkthrough • Performance and other comparisons • Final thoughts
Big Sites Sources: http://book.cakephp.org/1.2/view/510/Sites-in-the-wild http://framework.zend.com/wiki/pages/viewpage.action?pageId=14134 http://trac.symfony-project.org/wiki/ApplicationsDevelopedWithSymfony
Review - MVC Business Logic & DB Access • Most web frameworks are MVC these days • Lots of inconsistencies with the “model” layer HTTP Request HTML Source: http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller
Review - ORM • Object Relational Mapping • Maps database records to objects • 1-to-1 table to object class • E.g. job table -> job class • Layer of abstraction to: • Make code more maintainable • Enable stronger OO programming class TechTalk{ } ORM table: tech_talk
The Application • A basic job board where people can: • Add jobs • View a listing of jobs • Look at a post in more detail • So simple, you could probably code it in your sleep
Setup Download framework * Configure your app with your db Point your web server to the directory (i.e. vhost in apache) Start coding
Zend Code Summary • Nice command line tools -> less typing • Hard object instantiations play nice with IDE • Good, OO separation of layers, including db access, business logic, and forms • Cons: We’ll discuss later ;)
CI Code Summary • Super lightweight • Very few conventions or “magic” • Doesn’t force things on you • Very explicit • Lots of well documented tools and libraries
CAKE Summary • Rails-like convention over configuration • Very powerful, with convenient tools like scaffolding and strong relational mapping • Lots of “magic” that you need to be aware of
CONFIGURATION CI Zend CAKE CONVENTION
Documentation • Zend: • Complete, but fragmented • hard to follow. • CI • Great • CAKE • Outstanding
Performance • Source: http://www.ruilog.com/blog/view/b6f0e42cf705.html • Simple MVC logic, no DB connection • See site for full hardware specs
My Two Cents • Too much abstraction is bad • Understand the tradeoffs • You will need to break out of the framework • Stay curious