“The Yii Book”, Code for Chapters 22 & 23

November 18, 2014
The Yii Book If you like my writing on the Yii framework, you'll love "The Yii Book"!

Chapters 22 and 23 of “The Yii Book” are example chapters, in which I don’t cover new material but rather put together previous material in a more complete context. These example chapters have been popular in my other books, so I thought I’d include two in this book. The specific examples I came up with are:

The blog (Chapter 22) is a more complete version of what was commonly used as an example throughout the entire book. For the e-commerce example, I came up with the idea of selling books (imagine that!).

When I write such chapters for my books, what I do is create the entire code base first, and then write up the explanations. Doing it this way makes a lot of sense, as I’ll undoubtedly change things back and forth as I develop the project, so it’s best to start with a complete (ish) work. The writing itself then takes surprisingly little time.

I’ve completed the code for both examples, and only have the writing left. This means the final first edition of the book should be complete within days. Because people have been asking for the code, and to provide what I can as soon as I can, I posted the code for both chapters on GitHub (see the links above).

Again, to be clear, I’m in the process of writing up these chapters now, and that won’t take long; I just wanted to make the code available immediately.

Both GitHub repositories have README files that talk about the examples a bit more. Neither is intended to be complete complete complete. Rather, both work through the heart of the application, demonstrating many techniques you’d use on real world sites. In the actual chapters to come, I’ll explain the steps I took, the decisions I made, and how you might improve these examples.

Some of you may want to just look at the code (if you’re curious), others may want to use some of it (feel free!), others may want to wait a few days until the corresponding chapters are done. Whatever works best for you, I thought I’d make the code available now.

After I complete the first edition of the book, I’ll write the second edition (for Yii 2), and I’ll update these examples to be installable application templates using Composer, which is how application skeletons are created in Yii 2.

As always, thanks for joining me on this interesting, but WAY too long, ride.