Yii 2 For Beginners Update Image and File Management

I’m pleased to announce today the latest update of Yii 2 For Beginners with over 100 pages of new bonus material as of 3:00 pm pacific standard time on March 26, 2015. Anyone who has purchased on or before that date, and that includes today, can login to leanpub.com and pull down the latest version of the book.

As always, updates and bonus material for the book are free for the life of the book. Just login into your leanpub.com account and pull down the latest version. I highly recommend that you update to the latest version to get the most out of your purchase and take advantages of the new features built into the template.

I worked really hard to get this bonus material out to you, it covers a lot of new techniques, including use of Yii 2’s scenarios. The page count of the book is now over 600 pages. For those unfamiliar with the book, we take you step by step through setup and installation and then onto coding a reusable template.

The book features:

  • Setup and install
  • A Working user model
  • User registration and login
  • User Profile
  • Forgot password recovery
  • Frontend and backend/Admin separation
  • Helper classes
  • Access control
  • Free/Paid content control
  • RBAC with backend UI
  • JUI DatePicker
  • Facebook Social Widgets
  • Font-Awesome Implementation via CDN
  • Autoresponder Email for signup
  • Facebook Login & Registration with one click
  • Image Upload and Management
  • Multiple Social Auth Providers
  • Custom Data-driven Carousel Widget

More will be coming…

In this bonus material from this release, we cover basic image management, which includes uploading, updating and deleting both images and thumbnails. We also build a dynamically-driven carousel widget that is controlled by our admin UI.

You can set things like font size of the caption, show captions or not, show controls or not, etc., all from the backend UI.

This means you can hand total control of a key marketing area on the template over to the client and they will love that. Marketing is very important to clients and site admins and they will appreciate this level of detail.

I also went back to chapter 14 and added in the formatProviderResponse method both Google and Linkedin, which I had previously omitted. I’ve also included step by step instructions for setting up Google and Linked Apps, including screenshots to help you along.

While I was busy writing this update, some of our readers left positive reviews and comments on GoodReads.com, this blog, and the feedback section of the book’s landing page on Leanpub.com. This really inspired me to go all the way with the data-driven carousel and see how cool we could make it. I hope you like the results. I also hope you will contribute some positive comments and reviews of your own.

A number of readers also wrote in with typo notices and I jump on those immediately, with the turnaround within a few hours to 1 day. Everyone appreciates the efforts of all involved, it makes for a better reading experience for everyone.

Working on the Yii 2 framework is an amazing journey and I really enjoy sharing it with you. Thanks again for supporting our efforts.

Yii 2 Pretty Urls and Sluggable Behavior

I’m happy to announce another bonus chapter has been added to Yii 2 For Beginners. Everyone who has purchased the book gets free updates for the life of the book, just log into your leanpub.com account and pull down the latest version.

In this update, we focus on having our application use pretty URLs and on using slugs. Pretty Urls get rid of the ?r= syntax and the index.php part of the url. Slugs are strings that get attached the url to make them more visible to a search engine, like so:


It’s fairly easy to implement, but there are a lot of little things to get right and we go through all of them for a complete solution.

Also, as I mentioned in my last update, I made sure we were 100% compatible with Yii 2.0.3, which has just been released. I jumped on that on the day of release and everything went smoothly with the update, so no surprises there.

I also included in this update the correct jui DatePicker solution, which works with this update to the framework, so my workaround is no longer needed. A thoughtful reader was kind enough to send in a suggestion that includes setting the year as a dropdown list, so it’s easier to select the year, when you are picking the date. You will love it. That update is at the end of chapter 8.

I’ve decided to write smaller bonus chapters, so I can release the material more quickly. I’m working on a chapter dedicated to Yii 2 authclient and will have that done by the end of the month. This will allow a one-click login or register via facebook and other social networks. It’s an awesome feature of the framework, another reason to absolutely love it.

Thank you to everyone who wrote a positive review at GoodReads.com. Your comments are helpful to people who are thinking about learning the framework.

For anyone who does want to learn Yii 2, the core book is finished and will get you up and running quickly with a reusable template that you can use for your production projects. Since I use the template myself, I’m continuing to add to it, and as I do that, I continue to release bonus material in the book. It’s all free for the life of the book.

Thanks to all the programmers from around the world who are supporting my blog, my book, and participating in the polls. Over 400 people have already voted in the latest Yii 2 vs. Laravel 5 poll and we’re getting some interesting results. Thanks again and see you soon.

Yii 2.0.3 Released

Yii 2.0.3 was released today, and while that’s great news, it means I have to make sure everything in my book, Yii 2 For Beginners, is 100% working with the update.

So, today, I ran the composer update and everything went smoothly. In about 2 minutes, I was fully up-to-date and you have to love this framework for that.

Just for those who are unfamiliar with composer, the framework files live in a vendor folder, and when you run composer update, it reads your composer.json file and brings your vendor files up-to-date with the latest versions and dependencies.

So composer knew that once 2.0.3 was released, 2.0.2 was out of date, and it stripped everything out and replaced it with the newer version. What a fantastic way to maintain a framework.

The Yii 2 advanced template is somewhat of a unique case however, because the template code lives in the backend, common, and frontend folders, and that can change with a version release. Yikes!

This means I have to check every aspect of the advanced template to see if there are any changes that impact the re-usable template we build in the book as well as the out-of-the-box code, since I take us through the complete setup and explain things like the site controller and the related form models.

I have to review all that line by line. I’m happy to report only one minor change in the login method, which I quickly updated in the book, so as of now, we are 100% code working and 100% compatible with Yii 2.0.3.

For those following along in the book, no change is necessary due to today’s version release. I do recommend that you stay current on the latest release and do a composer update.

I’m happy to say that I got the full review of the release and the update of the book done on the day of the 2.0.3 release. I know from your comments, emails and reviews that this hard work is helpful to a lot of people.

The readers of the book have been helpful too, letting me know about grammatical errors and other typos. I typically respond within 24 hours to email requests. There hasn’t been any code breaking in quite a while and we’re closing in on 100% of the grammatical errors. I really appreciate the help and it makes a better reading experience for everyone else and this is helping drive the positive reviews.

Since no other action was required on my part due to today’s release, this gave me a chance to tighten anything up that was previously less clear and to cover anything unusual.

For example, a reader wrote in to tell me that he couldn’t get the date to work on the profile model unless he added the php prefix in the validation rule:

[['birthdate'], 'date', 'format'=>'php:Y-m-d'],

I couldn’t reproduce his issue, but I thought I would mention this in case you run into a similar problem and I updated the book to reflect that.

Anyone who purchases the book gets free updates for the life of the book, all you have to do is login to your leanpub.com account and download the latest copy.

For minor issues, like the above, I generally don’t make email announcements. However, I’m also working on bonus material that I’m adding on a quarterly basis (approximately) and I have more new material coming soon, so there will definitely be an announcement with that release.

The core material in the book is 100% complete, and you can get up and running quickly with it. But the template we build in the book is also one I use personally, so I’m always working on it, and it only makes sense to share it with you. Those updates are free for the life of the book.

The other thing notable to me about today’s Yii 2.0.3 release is that this is the third minor release since the 2.0 release 4 months ago. This means you can have confidence that the Yii 2 framework is being very actively developed.

In their own words, Version 2.0.3 is a patch release of Yii 2.0 which contains about 50 minor new features and bug fixes. These include some performance optimizations for RBAC, Page caching for RESTful repsonses, and more. You can read about it here.

Even though a version release for Yii 2 is a hectic time for me, I really do enjoy it. I love the architecture of the framework, and reviewing it for a version release reminds me how easy it really is to use and how it just keeps getting better.

Let me end with a special thanks to all the programmers from around the world who participate in the this blog by reading the aricles, taking the polls, leaving comments and writing reviews. It is very much appreciated and keeps me working hard to continuously improve. Thanks again.