Meet Yii: a new PHP framework

Lately, I've been searching for a robust, efficient and well documented PHP framework. In case you are not familiar with the term framework, all you need to know is that a framework is a set of programming code that is usually targetted for general purpose applications and is supposed to take the burden of coding repetitive tasks from the developer, leaving him/her to concentrate more on the business logic. So, a web application framework -and in our case- a PHP framework is a set of classes that deal with data validation, connection to databases, authentication, session management, etc., features that any web application has.

Lately, I've been searching for a robust, efficient and well documented PHP framework. In case you are not familiar with the term framework, all you need to know is that a framework is a set of programming code that is usually targetted for general purpose applications and is supposed to take the burden of coding repetitive tasks from the developer, leaving him/her to concentrate more on the business logic. So, a web application framework -and in our case- a PHP framework is a set of classes that deal with data validation, connection to databases, authentication, session management, etc., features that any web application has.

So, enough with the terms. After Googling a bit, I found a few frameworks for PHP. Zend, CakePHP, CodeIgniter, KohanaPHP, Symfony are among them. I started with CakePHP, read some basics and a couple of tutorials, but I found the documentation relatively limited. After doing some more Googling, I also found that it's not one of the fastest frameworks out there. Zend falls in the same case in terms of performance. CodeIgniter and KohanaPHP however, are on the other side. They are both fast, but, they lack features that Zend and CakePHP have out of the box. In the same internet resources regarding the performance of these frameworks, Symfony falls in the Zend and CakePHP group too, but I haven't looked at it at all. KohanaPHP is actually a fork of CodeIgniter with more features and is only PHP 5 compatible. Behind CodeIgniter is EllisLab, a company that sponsors CodeIgniter under the roof of ExpressionEngine, a CMS of theirs. As it seems, a lot of community CodeIgniter developers saw the slow adoption of features and the existence of a company behind the framework as a burden to keep improving the framework and so they decided to fork it and the fork became KohanaPHP (however, today, as many KohanaPHP folks say, the framework shares 0 lines of code with CodeIgniter).

So, I started peeking at KohanaPHP, but a major disadvantage is the lack of thorough and updated documentation for it. http://docs.kohanaphp.com is the site that hosts the KohanaPHP documentation, but it still needs a lot of work. The documentation must be updated for the current stable version 2.3.2, along with examples and inclusion of all class methods. After reading a great deal of it, it seems relatively hard for me to find techniques and tips on how to do stuff. CodeIgniter has a very good documentation at the framework's site, but I finally rejected it for the same reasons that led to the creation of KohanaPHP and for it being PHP 4 compatible.

After Googling again, I stepped on this post, which compared CodeIgniter, KohanaPHP and Yii. This post was the round 2 of the older comparison a year ago and I though to give Yii a try.

I forgot to say that most frameworks (if not all) use the notion of the MVC design pattern (Model-View-Controller, see here for more information).

I haven't peeked much at the Yii framework, but I can say that from my first introduction to it, it seems like the framework I was looking for. It has extensive documentation (a 153 LaTeX generated document that explains if not all, a very great deal of the framework, along with html files for all framework classes) and it also includes a php shell that automates the creation of models, controllers and other stuff I don't know so far! The latter is an excellent feature. Say you have a database table that holds eg. users. You enter a simple model user in the shell, and it creates the corresponding user model! You can also create the controller that automates the tasks of creating, updating, deleting users from your table, all this without any lines of code by you. I have to congratulate Qiang Xue, the person behind the Yii framework. Up so far, I am mostly impressed.

After I create my first application with Yii, I will post more details about it.

διάφορα / miscellaneous: 
υπολογιστές / computers: 
Χρήσιμο / Useful: 
Average: 3.2 (5 votes)
Ψηφίστε για την ποιότητα του άρθρου / Vote for the article's quality

Σχόλια

Να 'σαι καλά Billy... Πρώτα απ' όλα επειδή έμαθα τι είναι το PHP framework και στη συνέχεια, ρίχνοντας μια ματιά στο tutorial του Yii ανατρίχιασα!
Κρίμα που είμαι εντελώς σκράπας στο θέμα του OOP. Όπως λέει και ο Sahami στα μαθήματα που παρακολουθώ, "[...] there was actually people who argued that if you learn BASIC as your first language, you're brain damaged - you're just beyond help. [...]". Τόσα χρόνια, προσπαθώ μάταια να δείξω στον εαυτό μου ότι αυτό δεν ισχύει... :(
Καμιά συμβουλή;

You are beyond any repair! Μ' άρεσε αυτό που είπε ο Sahami στο μάθημα.

Anyway, ψάξε για OOP tutorials στο Google. Ένα παράδειγμα βρήκα στη Sun, αλλά θα έχει και καλύτερα φαντάζομαι. Δοκίμασε σε java να εξασκηθείς σε OOP, είναι από τα καλύτερα περιβάλλοντα για OOP και δε θέλει και ιδιαίτερο κόπο στο να εγκαταστήσεις το JDK και να ξεκινήσεις σε 5'.

Η PHP με την έκδοση 5 ουσιαστικά έγινε OOP, πριν ήταν procedural language και παραμένει ακόμη σε μεγάλο βαθμό.

Ακόμα παίζεις με Visual Basic;

χεχεχε.... ναι, αλλά ο ίδιος παραδέχεται ότι ξεκίνησε και αυτός από Basic οπότε δίνει ελπίδα στη συνέχεια... :)
Ναι, και εγώ σε αυτό το συμπέρασμα κατέληξα: Η Java ίσως με ξελαμπικάρει...
Μέχρι πριν 3-4 χρόνια ναι, έπαιζα ακόμα με VB6 (!!!). Βλέπεις δεν μπόρεσα ποτέ να συμμορφωθώ με τις αλλαγές της .NET εποχής. Κάπου εκεί κατάλαβα πόσο με είχε κάψει η παλιά Basic.

Αν είναι να προχωρήσεις με Java τελικά, προτείνω να το κάνεις με το Eclipse ή το NetBeans. Αμφότερα είναι εξαιρετικά.

 Kai egw perasa apo tin idia diadikasia kai kateliksa se Yii. Epsaxna kai egw php5, stictly OOP , MVC. Vevaia to Yii exei mesa enswmatwmeno kai to JQuery (AJAX framework). O Qiang Xue itan stin devoper team tou PRADO. To neo framework (Yii) exei dimourgithei se entelws diaforetiki vasi apo to palio (PRADO). Gi auto kai einai toso grigoro (!!!! twra den kserw an mporw na pistepsw oti einai toso grigoro). Episis fainetai na exei lavei ypopsin ola ta themata asfaleias ston pyrina tou Yii (XSS, cookie validation ktl ktl) ligo prosoxi thelei sto SQL injection.Ypothetw oti exei terastia ebiria apo ta palio framework kai gnwrizodas ta arnitika dimiourgise kati neo (etsi elege sta forum tou PRADO). Auto itan kai ena akoma apo to stoixeia pou me voithisan na to dialeksw (logika).
Kai egw to checkarw twra kai ftiaxnw merika application.