I wanted to write up a strong post on Access Control Lists in Yii, for controlling who can do what in an application. I still will, of course, but since authorization depends upon authentication, I thought it necessary to discuss Yii’s authentication system first. And, as happens with me, in writing about that, and how you would [intlink id=”849″ type=”post”]customize the authentication process[/intlink], I had to break the subject down into two posts. So here’s the first of an informal three-part series on authentication and authorization in Yii. In this post, I discuss how the parts of Yii’s authentication system work together; much of what I say in this first post is also available in the Yii documentation, just not presented in this way. I also show a couple of quick ways to modify its behavior to suit your situation. Continue Reading…
Archives For mvc
I’ve been writing a lot about the Yii framework for Web development using PHP. I’m a big fan of it and expect I’ll be using it for some time to come. I recently came across DooPHP, which I think is also worth consideration (although I haven’t yet used it myself). Besides having a really sharp Web site, some of the strengths of DooPHP seem to be:
- GUI tools for auto-generating code
- Many types of caches for improved performance
- support for replicated databases (great for demanding sites)
- REST support
I don’t plan on changing frameworks for a while, as I’m quite pleased with Yii, but if you’re looking for a new PHP framework, you may want to consider DooPHP as well.
I’ve been writing quite a bit about the Yii framework for PHP lately and thought a listing of useful resources would be in order. Yii is still a relatively new framework, so there’s not a lot out there, but people are taking an interest in the framework and making a point to share what they learn, which is always a good sign. To start, there’s the stuff at Yii’s site:
- The Definitive Guide to Yii, which is a descriptive overview of most of Yii’s features. This is a very accessible way to get into Yii.
- The Yii Cookbook, with lots of useful little recipes. Great for learning how to expand your application.
- The Blog Tutorial, which walks through the creation of a blog using Yii. Easy to follow, but not applicable to everything you’ll do.
- Yii Framework Class Reference, which details every class in the framework. This is the ultimate source for using the framework from a syntax perspective, but isn’t as easy to read and apply to your own code.
- The Yii Forum, for help and seeing what other people are doing.
All of the above are obviously linked on Yii’s own documentation page. That page also lists a Yii Cheat Sheet, plus some screen- and podcasts.
In working with Yii, I’ve also come across these writings:
Jonah’s Thoughts on PHP and Things Related has a handful of posts on Yii. They’re all from late-2008 and early-2009, so they’re getting to be a bit outdated but are still worth a read.
Kevin Korb has quite a few posts on Yii, specifically Yii+MySQL, plus a video tutorial on installing Yii on Mac OS X.
There’s a fairly long tutorial for beginners at SterlingSavvy.com.
My recommendation would be to start with the Definitive Guide, then move onto the other sources to help get a sense of a real-world use of those ideas.
After using Yii‘s command-line and Gii tools to build an application’s base structure, and then to create its Models and crud functionality, there’s still quite a bit of customizing to do (although Yii really does perform the bulk of the work). Previous posts discuss some of the common changes one makes to Models and Views at this point in the development stage; here I’ll discuss Controllers. I have personally found that I don’t make nearly the level of alterations to my auto-generated Controllers as I do to my Models and Views. This makes sense, as the Model should have the bulk of the code, the View is the interface the end user sees, and the Controller is largely an agent between the two (see [intlink id=”453″ type=”post”]my series on the MVC architecture[/intlink] for more on this).
(Note: In October 2010, I’ve updated this entire series to reflect changes in Yii since this series was written, and to take into account feedback provided through the comments. Some outdated material will be crossed out, but left in to reflect how things have changed since the series was begun in June 2009.)
This is the seventh post in my series on Yii, my favorite PHP framework. In this post, I walk through some basic View edits you’ll make to the code auto-generated by the Yii framework. For some of the code, I’ll be using the employees-departments example I’ve been developing throughout these posts. You may want to reread earlier posts to get a handle on those.
(Note: In October 2010, I’ve updated this entire series to reflect changes in Yii since this series was written, and to take into account feedback provided through the comments. Some outdated material will be crossed out, but left in to reflect how things have changed since the series was begun in June 2009.)