How to learn Yii?!

21 followers

Here is a step by step To-Do list for Yii beginners. The list is an advice of what tutorials and documentation you can walk through to get a full understanding of the Yii Framework. These can be a help to learn Yii.


BASICS

  1. Learn PHP

    You need to know how to program in PHP. You can find many tutorials on the web, or buy a book. If you'd like a book, I recommend Larry Ullman's books. Some people learn PHP from the PHP manual. Two web tutorials can be found on webmonkey and home&learn.

  2. Learn OOP

    You need to know the basics of how Object Oriented Programming works. Same as above: use Google or buy a book. You need to read the PHP manual on OOP. It will take you a few hours. Another tutorial about OOP can be found here, and a video tutorial here.

  3. MVC

    It is very important to understand what the Model-View-Controller pattern means! If you don't, you will think Yii is chaos. As soon as MVC "clicks" in your mind, you will see the very logical pattern. Read up on one, two and three. You can also find an article here about Understanding MVC.

  4. jQuery

    I highly recommend reading (or even rereading) the Getting Started with jQuery page from jQuery.com. These are some basics you need to know, since Yii uses jQuery as well. If you want to dive more into jQuery, I added some more links at the Extra's at the bottom.

  5. API pages

    The following is important to always remember: You always need to open the API pages on functions you're using. The descriptions of all functions of a language can be found here. The API docs are your memory, since your brain can't remember it ALL. ;) For PHP, use the search box on the top right of PHP.net. For jQuery, you can search the jQuery Docs. And here is the API for Yii 1.1 and for Yii 2, both of which have a search feature.

YII

  1. Easy introduction

    For visual explanation of Yii 1.1 there are screencasts. After that, read up on Larry Ullman's easy tutorial series. Larry also has a video presentation: Faster Web Development with Yii Framework 2.

  2. The Definitive Guide to Yii

    The Definitive Guide to Yii is the central and most important learning resource for Yii. It is definitive and was written by the core Yii developers. It is available for Yii 1.1 and Yii 2. Just walk through all pages from top to the bottom. Tip: Also check out the comments on the bottom of the pages.

  3. Doing stuff

    At some point while you read the Definitive Guide you'll want to get started with coding in Yii. If you begin with one of the conventional starting points then you stand a better chance of getting help when you need it.

    • For Yii 1.1, do The Yii Blog Tutorial which takes you setp-by-setp through all the basics of implementing a web app with Yii. Yii 2 does not have an equivalent tutorial yet.
    • For Yii 2, there are two demonstration applications: basic and advanced. Follow the instructions in the README of those apps to install. Then study the code and start experimenting.
  4. Got confused what's happening?

    You can trace all variables to the Yii Log to see what's in them. You can find more info here: How to log and debug variables using CWebLogRoute Irreplaceable for everyone to see whats happening! This is the best trick you ever learn:

    Yii::trace(CVarDumper::dumpAsString($var), 'NAMEOFYOURTRACE');

WHAT THEN?

  1. Extra's

    There are a lot of good tips for Yii 1.1 in the Yii Application Development Cookbook. (If you buy it, check the errata section on their website.) Also check out the Yii Wiki and the Yii Class Reference. Tip: You can view Yii source code directly in the API docs. Also, the lookup/search box in there is invaluable.

  2. jQuery

    Yii uses a lot of jQuery javascript. You really need a basic~good understanding of jQuery for the things you go up against. You can find an elaborate tutorial here, and a jQuery for Beginners video tutorial can be found here.

  3. Community

    If you have questions, head towards the Community forums or the irc chatroom at #yii on irc.freenode.org.

  4. More tools

    There are a lot of extensions for Yii. These are extra "toolboxes", made by the Yii community, that you can re-use in your applications.

  5. Return ... to the Source

    To really understand Yii and use it most effectively, get into the habit of reading the Yii classes themselves. They are just PHP code that becomes part of your project. They are written using a simple, clear and consistent style. Remember to return to the source.


Basics - can take days, weeks or years. ;) Yii - Step 1 & 2, takes a few hours. The rest takes days, or a few weeks if you're doing things parttime. After all that, you should go into the depths of building your own custom Yii stuff!

Have fun with Yiiing! Kind regards, Jeroen

[Updated by thefsb/tom[] Oct 2014]

Total 8 comments

#14064 report it
WaldemarPross at 2013/07/16 10:02am
Intuitively followed this path

Why I didn't find this article weeks ago? Anyway, I followed exactly this path.

I would say to understand OOP and MVC is really important. Once you did it, it kind of defines the frame for how you will thing while developing.

Also I would recommend not to follow it completly linear, but for example read the Definitive Guide a little, code a little using the tutorial, then read specific things you come across when you code. So it will be in a context of real tasks.

#10301 report it
WebDevPT at 2012/10/18 05:39am
You can still pick up

RE: Hans Nataniel

You can still start from the current books and learn Yii. In fact I started to learn Yii last year, and decided to develop some applications earlier this year with the same books as reference and help, no big changes since I started.

Follow the links posted here and you will learn a lot. You will cover the basics and all you need to get you started.

#10293 report it
Hans Nataniel at 2012/10/17 11:01pm
Yii Agile Web Application Development book

What if I learn Yii Agile Web Application Development book with the latest version (1.1.12) of Yii Framework? Is there a lot of problem will occur? And how can I fix it?

#9688 report it
yJeroen at 2012/09/03 02:05pm
Hmm

Thank you for your feedback Callum.

I do think that debugging is a topic that deserves a full elaborate wiki page itself.. If you know some more wiki pages that explain the topic well, please message me on the forum.

#9633 report it
Callum Rexter at 2012/08/30 07:30pm
A better way to debug

Great info, very clear and some great links - I would add for debugging, if you get a little confused there is nothing better than running something like XDebug in Eclipse or NetBeans and following through that processing either step by step or stopping at set breakpoints.

#5840 report it
yJeroen at 2011/11/19 05:26am
Thanks for feedback!

Hi Andy,

Ofcourse I should add in the Extensions repository!

Hi Drumaddict,

I never said you should be a php expert. ;) But you do need some knowledge about it. Though, as every programmer knows: If you know how to ride one bicycle, its easy to pick up a different one as well. I'll try to change some of my wordings to reflect that. Thanks!

#5767 report it
drumaddict at 2011/11/10 03:34pm
Disagree on some of your points,good list overall though.

Let me disagree on some of your points.I don't think you need to be an expert in PHP to start with Yii.I came from Adobe's Flex framework to Yii and I had no idea about PHP.OK,so maybe I spent a few days to learn some basics of the syntax,but I don't agree that you have to spent years in learning PHP before you take up Yii. About MVC.I think you can learn MVC in the context of Yii,no need to "take a course on MVC" just to understand Yii's MVC.Just dive into Yii and you'll understand MVC as you go. I agree on 4-7.I think the inportant point is that if you have a programming experience and know the basics of OOP,learning the basics of Yii will be easy.

#5750 report it
andy_s at 2011/11/09 09:42am
Nice

Nice one! Very short and clear.

Though, even if it takes few days/weeks to read Yii guides and stuff, it can take much more time (months) to learn how to solve different problems using Yii, to understand its philosophy and the source code.

Also I think you should mention Extensions repository, because there are many nice & useful components which can help a lot in the process of learning and using Yii :)

Leave a comment

Please to leave your comment.

Write new article