Simply put, a framework is an established library of code meant to expedite software development. Writing everything from scratch on every project is impractical; code reuse is faster, more reliable, and possibly more secure.
Many developers eventually create a lightweight framework of their own, even if that's just a handful of commonly used functions. True frameworks such as Yii are just the release of a complete set of tools that a smart and hardworking person has been kind enough to make public. Even if you don't buy the arguments for using a framework in its own right, it's safe to say that the ability to use a framework, whether that means a few pieces of your own reusable code or a full-fledged framework such as Yii, is to be expected for any regular programmer today.
Why You Should Use a Framework
The most obvious argument for using a framework is that you'll be able to develop projects much, much faster than if you didn't use a framework. But there are other arguments, and those are more critical.
As already stated, framework-based projects should also be both more reliable and secure than one coded by hand. Both qualities come from the fact that framework code will inevitably be far more thoroughly tested than anything you create. By using a framework, with established code and best practices, you're starting on a more stable, secure, and tested foundation than your own code would provide (in theory).
Similarly, a framework is likely to impose a quality of documentation that you might not take the time to implement otherwise. The same can go for other professional features, such as logging and error reporting. These are features that a good framework includes but that you may not get around to doing, or doing properly, despite your best intentions.
Still, the faster development argument continues to get the most attention. If you are like, well, almost everyone, your time is both limited and valuable. Being able to complete a project in one-third the time means you can do three times the work, and make three times the money. In theory.
You can also make more money when you know a framework because it improves your marketability. Framework adoption is almost a must for team projects, as frameworks impose a common development approach and coding standard. For that reason, most companies hiring new Web developers will expect you to know at least one framework.
In my mind, the best argument for using a framework is this: so that you can always choose the right tool for the job. Not to be cliché, but I firmly believe that one of the goals of life is to keep learning, to keep improving yourself, no matter what your occupation or station. As Web developers in particular, you must continue to learn, to expand your skill set, to acquire new tools, or else you'll be left behind. Picking up a framework is a very practical choice for your own betterment. In fact, I would recommend that you actually learn more than one framework. By doing so, you can find the right framework for you and better understand the frameworks you know (just as I understood English grammar much better only after learning French).
Why You Shouldn't Use a Framework
If frameworks are so great, then why isn't everyone using a framework for every project? First, and most obviously, frameworks require extra time to learn. The fifth project you create using a framework may only take one-third the time it would have taken to create the site from scratch, but the first project will take at least the same amount of time as if you had written it from scratch, if not much longer. Particularly if you're in a rush to get a project done, the extra hours needed to learn a framework will not seem like time well spent. Again, eventually frameworks provide for much faster development, but it will take you a little while to get there.
Second, frameworks will normally do about 80% of the work really easily, but that last 20%---the part that truly differentiates this project from all the others---can be a real challenge. This hurdle is also easier to overcome the better you know a framework, but implementing more custom, less common Web tasks using a framework can really put you through your paces.
Third, from the standpoint of running a Web site or application, frameworks can be terribly inefficient. For example, to load a single record from a database, a framework may require three queries instead of just the one used by a conventional, non-framework site. As database queries are one of the most expensive operations in terms of server resources, three times the queries is a ghastly thought. And framework-based sites will require a lot more memory, as more objects and other resources are constantly being created and used.
{NOTE} Frameworks greatly improve your development time at a cost of the site's performance.
That being said, there are many ways to improve a site's performance, and not so many ways to give yourself back hours in the day. More importantly, a good framework like Yii has built-in tools to mitigate the performance compromises being made. In fact, through such tools, it's entirely possible that a framework-based site could be more efficient than the one you would have written from scratch.
Fourth, when a site is based upon a framework, you are expected to update the site's copy of the framework's files (but not the site code itself) as maintenance and security releases come out. This is true whenever you use third-party code. (Although, on the other hand, this does mean that other people are out there finding, and solving, potential security holes, which won't happen with your own code.)
How You Use a Framework
Once you've decided to give framework-based programming a try, the next question is: How? First, you have to have a solid understanding of how to develop without using a framework. Frameworks expedite development, but they only do so by changing the way you perform common tasks. If you don't, for example, understand basic user interactions in conventional Web pages, then switching to using a framework will be that much more bewildering.
And second, you should give in to the framework. All frameworks have their own conventions: how things are to be done. Attempting to fight those conventions will be a frustrating, losing battle. Do your best to accept the way that the framework does things and it'll be a smoother, less buggy, and faster experience.