Retrocade Network: Mauft.com | Zolyx.co.uk

Getting Started with Yii

Posted on Fri, 7th September 2012 7:34 No comments comments

by Skell under PHP


There is quite a lot of ready resources about how to start your way into Yii:

  1. The Yii Blog Tutorial is the best resource if you know a bit about MVC, PHP and general server-side development. It details more or less step-by-step how to develop a small blog application in the framework. It goes over most of the steps you need to take: preparing your database schema, Model and CRUD generator, working with filters, validators, relations, adding comments and basic admin interface. I personally recommend to read it thoroughly, and either not do the steps at all, or adapt them to your needs on the fly.
  2. Larry Ulman's introduction to Yii is more suited for the beginners, and will be your best bet if you are still new in the business or do not feel confident in your skills. Once you get done with it, I suggest to move back to the blog tutorial above.
  3. The Definitive Guide to Yii is just what the name implies. It's a very broad guide covering lots of topics, and it might be a little overwhelming at first. If you do not want to read the whole thing (though it is recommended to at least skim through each page), I think these couple of pages are the most important:
    1. Database Migration - contains information about managing database schema updates. This is essential to remain sane while keeping the production and development environments in sync.
    2. Active Records are what your models will extend and they map rows from database to objects. It is also a great time to introduce CDBCriteria, a class used to work with queries (it makes it easier to maintain conditions, relations, sorting, grouping, parameters and others).
    3. Relational Active Record is an extension to the previous topic and explains one of the many things where Yii really shines - relations and how to use them to leverage all the query building and parsing results to the framework. This page is a must have, add it to your bookmarks and reference it as often as you need.
    4. Console Applications - the moment you want to use CRON is the moment when you will want to read this page. It allows you to create functions which can only be called from the command line and give the benefit of being faster, more secure and in line with conventions.
    5. Performance Tuning. This. The most important thing. Do not even attempt to push anything into production before reading this section and applying it. It's not part of the definitive guide, it's a page from the Blog Tutorial, but it's too important to not mention it separately. To be honest, I am surprised it did not make its way into the definitive guide.

Heck, that's not even all, if you feel like reading more, here are also importan pages:

  • Yii Tutorials contains the three above links, books about Yii and links to other server-side development books.
  • Full API documentation contains generated docs for all the existing classes. This info can be found in Yii's source code too, but here it is much more readable.
  • "Wiki" is not exactly a wiki, but rather a collection of community articles. Works best with google search in my opinion.
  • Forums are the place to ask your questions.
  • Live Chat allows you to join the Yii channel on IRC (Freenode server) without even leaving your browser!

Feel free to ask any questions you might have about the framework in comments, I'll be happy to answer in comments or with a new post!

« Site updates and introducing YiiLinx Mobile »

Preview Today

Speak your mind!




Post

Search and stats:



  • Visits today: 16
  • Visits in total: 421,055
  • Game plays today: 17
  • Game plays in total: 547,154