Category Archives: Yii 2

Laravel 5.4 For Beginners Book Released

I’m really excited to announce the release of my latest book on Laravel, Laravel 5.4 For Beginners.  This book represents a huge leap forward for me both as a coder and a writer, as we dig deeper into the Laravel framework.  I covered a lot of ground that I hadn’t previously covered, and the book is as of this writing at 763 pages.

In theory, it would be simpler for me to just provide an upgrade guide for the previous version and just update the old book, but that doesn’t work for a number of reasons.  One reason is that the Facebook one-click registration and authentication implementation relies heavily on the traits that ship with Laravel, and those change with every release.

Also, with this release, Laravel no longer ships with Elixir, but comes with Laravel Mix instead, so I had to rewrite all of those instructions as well.

Of course I’m not satisfied with just an updated version of the book, I wanted it to cover new ground.  So one of the big new sections of the book is chapter 14, where we build a working chat application that updates in realtime.

For that we use a mix Laravel Echo, Vue.js, and Pusher.  This is a fun build and we get to learn more about nested components in Vue.js.

With all the work we do with Vue.js on the searchable, sortable data grids, and the additional work in the chat application, it’s a nice little quick start to Vue.js if you haven’t worked with that before.

Also new in this edition, we cover Laravel’s wonderful eventing architecture by creating a mail event on completed registration.  This takes advantage of the new markdown feature to make the email “pretty.”  And of course we send dynamic data to the email, like the username.

Besides covering all the basics, like we have in the past versions of the book, we also cover some of the interesting parts of Laravel’s architecture, like the service container, service providers, automatic injection, and the new on-the-fly facades.

I think the dynamically generated facades are going to have a huge impact going forward, it’s another wonderful innovation from Laravel.  I cover it briefly in the book, where we also cover service providers and class bindings.  We learn how to code to a contract rather than a concrete class.  That’s a little more intermediate, but we provide a gentle introduction to it.

I also thought it would be cool to support the chat application with a custom console command that you can run as an artisan command or as a cron.  The command deletes all but the most recent 30 messages, so you don’t overwhelm your application with chat messages.

To recap what we cover in the book, we build a sample application that covers the following:

  • One-click Facebook Registration
  • Full Access Control
  • Datagrid with column sorts, powered by Vue.js
  • Image Management with Intervention Image Package
  • Laravel Mix Asset Management
  • Events
  • Sending Email with Markdown
  • A working Chat application with realtime updates
  • Laravel Echo, Vue.js and Pusher
  • Plus all the basics of application development

For those of  you who purchase the book, I hope it helps you meet your programming goals.  I really appreciate all the support, comments, ratings and reviews I’ve received, since I launched this blog.  Thanks to my readers for sharing the learning journey with me. See you soon.


Free Book By Eric Borgos

One of the people that mentored me early in my career as an entrepreneur was Eric Borgos, a web wizard who made millions as a one-man operation. Eric recently wrote a book, How to Make Money Online, and he has generously made his book available to my readers for free. All he asks in return is that you review it on Amazon.

You can find the free downloads here for each version:

I can tell you from personal experience that Eric has wisdom to share. I have benefitted from that wisdom myself, his advice and encouragement helped me launch my own business career many years ago.

Eric’s book is a fascinating read for anyone who is trying to make money online, but it’s especially potent for developers because it gives you a sense for what can be done if you have skills. Eric wasn’t a programmer, he always had to pay for programming, but nevertheless he has an engineering sensibility that found efficiencies in interesting places.

I highly recommend this as a pleasure read for anyone who is working in tech, and that’s a very broad way of describing it these days, but I like it because it encompasses so much. If you ever get the chance to sit down with someone as brilliant as Eric is to pick his brain, take that opportunity. You will be amazed at how much you can learn. His book is getting a well-deserved 5 star rating.

Thanks again to everyone for all the positive reviews on Yii 2 For Beginners. Also special thanks to all the programmers from around the world who follow my blogs, all likes, comments, and reviews are greatly appreciated.

Yii 2 Para Principiantes Published Today, it’s Yii 2 For Beginners translated into Spanish

I’m happy to announce that Yii 2 Para Principiantes has been published today. This is Yii 2 For Beginners translated into Spanish language by Victor Hugo Garcia.

Victor put a lot of great work into this translation, including translating class names and DB tables into Spanish names when appropriate. The translation covers the core book, up through chapter 11. After that, the bonus chapters are provided in English and will be updated into Spanish as they become available.

Anyone who purchases the book, whether it is the Spanish Version or the English version gets free updates for the life of the book. All you have to do is login and pull down the latest version.

Like its English counterpart, Yii 2 Para Principiantes will take you step by step through setup and installation, and then on to coding in one of the most exciting PHP framework available today. The book focuses on creating a reusable template that can serve as the basis for your projects, including the following features:

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

I’d like to give a personal thanks to Victor, who not only gave me a great review on the book at, but then later also volunteered to write the translation. He put a lot of work into it, so that is greatly appreciated.

Thanks again to all the programmers from around the world who have supported the book, it makes this work possible. I hope you find the book helpful.

Yii 2.0.4 Released

Today marks the release of Yii 2.0.4, which according to the release statement, is a patch release containing over 100 minor new features and bug fixes. I ran composer update on the template that we build in my book, Yii 2 For Beginners, and I’m happy to report that nothing broke, so no modification is necessary this time out.

I recommend updating to version 2.0.4. Like I said, it’s simple, just run composer update from the command line and you will get the latest version that will bring you up-to-date.

In other news, we have a Spanish translation of Yii 2 For Beginners being released soon, so that is very exciting. Victor Hugo Garcia is doing the translation and we’re looking forward helping Spanish-speaking programmers get started with Yii 2.

Learning a PHP framework can be a daunting task. I know this because it was difficult for me, and that inspired me to write the book. I’ve come to understand that learning a framework, much like learning programming itself, is a journey, not a destination.

Many times I thought of learning PHP in terms of one framework vs. another, and in some ways, that is what kicked off this blog back in March of 2014. However, my view on this has evolved.

I think it’s important to learn multiple frameworks. It will allow you to see programming from different angles, different approaches, and you will learn from all of them. Then you can decide which one is best for you, or even better, you can gain proficiency in multiple frameworks. This gives you more value to potential clients that might want you to do a project in a framework other than the one you prefer.

The programmers that build and support these frameworks, Yii 2, Laravel, Symfony 2 and others, bring an amazing amount of innovation, talent and infrastructure to support your growth as a programmer. As I mature as a programmer, I have come to value all of them for the contributions they have made to PHP programming. Where would we be without them?

So today, being a release day for Yii 2.0.4, I will thank the Yii team once again for all the amazing work that they do.

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 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.