Laravel 5.4 For Beginners Bonus Chapters Released

Access all articles in sprocket icon.

Published February 6, 2017 by Bill Keck.

Laravel 5.4 For Beginners Bonus Chapters Released

Chapters 13 and 14 have been added to the Laravel 5.4 for Beginners book.  The book is now 745 pages in length.

Anyone who has purchased the book can download the updated version for free, by logging into their Leanpub.com account.  All updates are free for the life of the book.

In chapter 13, we cover sending mail and events.  We work up an email that we send to registered users, when they complete registration.  We also explore the different composition tools for creating mail, including the new markdown features, which really help us make a pretty email, with almost no effort.

We also cover events and listeners, and to demonstrate, we convert our simple mail message to an event, using artisan’s event:generate command.  Eventing is a powerful design pattern and we cover it a way that is easy to grasp for beginners.

Finally in Chapter 13, we talk a little about Laravel’s amazing architecture.  As I was going through some of the material, I found the following comment from Taylor Otwell, the creator of Laravel, in public/index.php:

We need to illuminate PHP development, so let us turn on the lights. — Taylor Otwell

I liked that quote so much, I made it the dedication to the book.

We learn just how well thought out the architecture is when we start looking at the service container, service providers, and automatic injection.

In chapter 14, we build a working chatroom, using Laravel Echo, Vue.js, and Pusher.  It’s not super fancy, but it does have realtime updates, changing the room count when people enter and leave, and of course updating all messages for all users in realtime.

This chapter introduces us to Laravel Echo and Pusher, which we have not used previously, but also gives us the opportunity to work with nested Vue components.

We also start to work with ES6, also known as EchmaScript 2015, which is the latest version of javascript.  If you are not familiar with ES6, don’t let that put you off.  I take it line by line to explain that syntax when we use it.  Turns out it’s pretty intuitive.

In chapter 14, we also build a console command that deletes database records, so our chat application doesn’t overwhelm our DB with too many records.  We need to maintain it, so we learn how to schedule the command twice a day, so a cron can run them.

For those who follow my work, these are additions that were not covered in previous versions of the book.  Every time there is a new release of Laravel, I have to rewrite the book because of the many small changes that happen.  It’s a lot of work.  And sometimes there is a big change, like the move to Laravel Mix and dropping Elixir.

I strive to make the new versions of the book appealing to both readers who are just starting with Laravel and for those who have read the previous versions.

Thanks again to everyone who has supported my work, I really appreciate it.  I look forward to continuing the learning journey with you.

Laravel 5.4 For Beginners Officially Released

Access all articles in sprocket icon.

Published January 30, 2017 by Bill Keck.

Laravel 5.4 For Beginners Officially Released

Ok, the new year is off to a great start, and I’m proud to announce the latest version of my Laravel For Beginners books.

This book covers in detail, at 626 pages, everything you need to know to build a web application using Laravel 5.4.  We cover all the basics of routing, controllers, models, with clear explanations on how it all integrates with Eloquent and MySql.

It’s part of my mission as a PHP writer to make this work as accessible as it can be to everyone.  Laravel makes that easy.  And this book goes step by step, with a full understanding of the concepts covered.  You don’t have to be a ninja to get it.

In the book, we also cover the following:

  • Access Control using middleware and traits
  • Socialite Facebook one-click registration and login
  • Image management
  • Vue.js basics using Vue 2
  • Searchable, Sortable Datagrids, using Vue components
  • Asset Compilation, using Laravel Mix
  • Mail and Events
  • Service Providers

Laravel Mix is new to Laravel and it replaces Elixir as the default asset build tool.

Laravel 5.4 For Beginners is available now on Leanpub.com.

I really appreciate all the support and great reviews I’ve gotten on the past books.  We’re already set up for new reviews at GoodReads, but obviously there are no reviews for this book yet.

For those that have purchased the previous version of the book, the move to Laravel Mix is a big difference between the books.   Also new, we cover mail, events, and application structure, including understanding the service container and service providers.

Because we analyze and explain in great detail things like the RegistersUsers trait, and many other parts of the framework code, each new version of the book has a lot of small differences from past versions.  This is also the reason why I don’t simply update the old version or provide a migration guide.

As with all of my books, I do expect to be adding bonus material, which will be free for anyone who has purchased the book for the life of the book.

As of this writing, I’m hard at work on a bonus chapter that will build a basic chat, using Laravel Echo, Vue.js, and Pusher.  I expect that to be done by February 15, 2017.  All updates are free for the life of the book.

This is my fourth book on programming and I feel it is by far the best one.  I hope you will agree.  Thanks again for all the great feedback.

Learning Frontend Development with Javascript and Vue 2.0

Access all articles in sprocket icon.

Published December 10, 2016 by Bill Keck.

Learning Javascript and Vue 2.0

Ok, so from time to time, I share resources that have aided me in my continuing education in programming. As those of you who follow me know, I’ve never been strong in front end development and that is something I’m currently working to change.

I recently reached out to Matt Stauffer, host of the Laravel Podcast, to see if he had a recommendation for learning frontend development. He was nice enough to make a recommendation, but before I tell you what he recommended, let me describe what I’m interested in learning.

I have found numerous tutorials online about html, css, javascript, etc, but the parts never seem to make up the whole. Yes, I can code basic Bootstrap like everyone else, but I never feel like I’m actually doing anything interesting or anything that would lead to a positive user experience.

I’m always lost when I try to conceive of the UX beyond basic Bootstrap. It’s like I want to write a beautiful sentence without having a vocabulary. Learning a word here or there doesn’t seem to help. I want to develop a sense for the flow of the language overall before I try to write anything. What does that mean in terms of UX? I don’t know, which is why I’m looking for help.

I’m a big fan of structure in learning. I’ve gotten so much from Laracasts, which we will talk about more in a minute, that I’m spoiled. I want that level of instruction in all learning.

As useful as Laracasts is, and it is incredibly useful for learning individual tools, it doesn’t help me develop the concept of UX. I want to learn and develop my UX capabilities from scratch. I want to be able to view application development from the standpoint of the frontend.

So I posed this question to Matt Stauffer and he recommended Code School, which is also online video instruction, coupled with online testing, which I really like. The cost of Code School is $29 per month, and it’s totally worth it, the quality of the instruction is awesome.

After completing a beginner course in html 5, I jumped into the javascript Road Trip series. Learning javascript is fundamental to developing a sense for frontend programming. Your application won’t be reactive without it.

I don’t know how you feel about javascript, but I’ve always hated it. Programming in javascript just always felt like a bunch of fragments thrown together in one big or small plate of spaghetti, depending on what the needs of the page are.

Recently, I started working with Vue 2, which is a javascript framework favored by many Laravel developers. It is powerful, but relatively easy to use, which is probably why it’s so popular. Vue 2 is supported by a book, the Majesty of Vue.js 2, which is excellent for learning the basics. I rate it 5 stars.

There’s also a brand new series on Laracasts for Vue 2, Learning Vue 2 step by step, which really showcases the power of Vue 2. It’s another top-notch series from Laracasts, you can’t go wrong there.

I should note that I cover the very basics of Vue 2 as well as creating an ajax-powered datagrid in my book, Laravel 5.4 for Beginners. That includes sorting, searching and pagination. But for more comprehensive learning about Vue, I recommend the Vue book and Laracasts.

With these resources, you can start to get a sense of the architecture and capabilities of Vue 2, and how it can add reactivity to your page. Reactivity is critical to modern design. The Laracasts series shows you, for example, how different components created in view can interact with each other via events. Cool stuff.

In the Code School series, which I’m still working my way through, it tackles the fundamentals of the javascript language, which is easy to overlook when you are coding patchwork in javascript. I tended just to learn what I needed for the moment and often forgot it as fast as I learned it. Now that I have more of a background in javascript, it is making more sense to me, though I still much prefer coding in PHP.

One reason why I always feel like I learn slowly is that I only feel like I know something if I really know it, not if I sort of know it. For example, for the longest time I would see references to the html DOM, domain object model, without really understanding what it is. I had just this fuzzy concept of an object. But what does that mean?

The DOM is a copy of all the html attribute tags, such as body, div, article, etc., held in memory, so that javascript can operate on it. So if you have a div with an id of “container”, for example, you can reference that div in javascript and operate on it. It’s really that simple.

This is why it’s important to study a language from the ground up. Doing so gives you a sense for how things work and why things are done a certain way.

Even as I study javascript, things are changing. ES6, also known as ECMAScript 2015, is a significant update to Javascript and has introduced new syntax and features. It’s a lot to get your head around if you are just starting. If you are not a fan of constant learning, you should have probably picked a career other than programming.

With Laravel Mix, you can easily integrate ES6 syntax and Vue.js into your applications, and there is a great Mix series on that in Laracasts.

Laravel ships with a sample Vue.js component and I cover how to implement that in Laravel 5.4 For Beginners. If you are using Laravel, you will find both Vue.js and Elixir invaluable.

But knowing all that doesn’t make you a great frontend developer. I’m still on the hunt for that. My plan now is to focus on Javascript and reactivity, then move into the more visual parts of the UX. On the javascript side, I expect this to take a year or more.

Learning programming is a journey and I feel like I’m finally well on my way to a deep dive into frontend programming. I still don’t have an artistic sense for it, but that is not my focus yet. I’m going to leave that for the very end, since I believe that in order to achieve artistic success, you must first have command over the tools that you need in order to create it. Javascript is absolutely essential for that.

Why I love Laracasts

Access all articles in sprocket icon.

Published November 14, 2016 by Bill Keck.

Why I love Laracasts

I’m doing a quick post on why I love Laracasts. Now I’ve written before about how amazing Laracasts is, and how I think it is well-worth the price of subscription, especially if you are ready to move on from beginner into a more intermediate level. So rather than give a big overview, in this post, I’m going to talk about a particular lesson:

Cleaner Webhook Management

Before I start, let me mention that I’m not going to reproduce the lesson here, that would be a copyright violation and I have no intention of doing that. Laracasts is a paid service. I know it’s tough to let go of educational dollars, but Laracasts consistently delivers high quality videos that improve my programming skills, so I’m a happy subscriber. I think that’s true for most programmers that have tried it, since Laracasts has so many subscribers.

Anyway, the lesson I’m referencing above demonstrates a couple of things that I got excited about. One was using a handle method on a controller to consume different types of request data and use it to a call a conversion method dynamically. Sounds complicated, but it’s not.

What a lot of us fall into is writing if statements or switch statements to handle the different request possibilities. But that gets unwieldy when the number of possibilities from the request scales. So Jeffery Way’s implementation is a nice solution and is super clean and easy to follow.

The other thing I loved in the lesson was his use of a unit test to flush out the method and see if it was translating the request data properly. He also shows us how to filter down the unit test to just a single test or method, so you don’t have to run all your unit tests. That saves a lot of time.

All of this happens in 8 minutes and 51 seconds, so the video just moves along at a rapid pace. I’ve watched it 3 times to make sure I have a rock solid understanding of all the principles that were expressed.

Laracasts places a huge emphasis on clear, maintainable code, which means that even if you are not necessarily needing the implementation at hand, you learn a lot just by watching Jeffery Way’s approach to solving problems. There’s an art form to writing cleaner, more extensible code, so it’s always a pleasure to learn how to improve our code.

One of the things I’ve noticed about the best programmers is that they always strive to improve. If there is a way to increase their programming knowledge and speed, even if it is very incremental, they are all over it. You never know when something small can turn out to be big.

For example, at work we recently did a migration that caused the old domain cookie to become invalid. This threw off a symptom that would keep calling login, because the session was never set properly. The only answer for that is for the user to clear the cookie. Since I worked with implementing Socialite and changing the session domain, I knew what was causing the problem, as soon as I heard about. It seemed like such a trivial thing. But we were able to get the message out to customer service quickly, and they put out a site message as well, so we overcame it quickly. We would have tripped over that, were we not familiar with the issue. It’s a case where the constant learning came into play and helped out.

Learning is not a destination, it’s a journey. Laracasts, for me, has been a critical part of that journey. After 3 years of subscribing, I still find new things to be excited about…

Thanks to everyone who has and is supporting my work, sharing the journey. I don’t have a donate button, but if you would like to contribute, you may do so by buying one of my books, Laravel 5.4 For Beginners. I would really appreciate it. Shares, comments, likes, and book reviews are also greatly appreciated. See you soon.

make:social-app command released for Foundation Maker

Access all articles in sprocket icon.

Published October 23, 2016 by Bill Keck.

make:social-app command released for Foundation Maker

I pushed through the weekend and was able to get the make:social-app command done for Foundation Maker. For anyone unfamiliar with it, Foundation Maker is a free package that currently adds 19 new artisan commands.

Installation via composer is a snap. Just run the following from the command line:



composer require evercode1/foundation-maker

Then add the following to the providers array in config/app.php:



Evercode1\FoundationMaker\FoundationMakerServiceProvider::class,

Then run:



php artisan list

So if you’ve been following this blog, you know that Foundation Maker is a code generator and you can check out the docs for a full list of commands.

For now, we are going to focus on make:social-app.

The make:social-app command is intended for use with a fresh install of Laravel. It will overwrite many files, and therefore is not to be used with an existing project.

Also note, that the application the command will produce is dependent on the following packages being installed:

And obviously, you would have to have Foundation Maker installed as well. If you have read my book, you will be familiar with the code this command produces, we cover it extensively throughout the book. Again, you can check the docs to get an idea of all the files it creates for you.

The social app that Foundation Maker creates handles social authentication with one-click through facebook, but you do need to set up your facebook app and grab the credentials and paste them in your .env file for it to work. It takes less than a minute, if you have done this before.

Then all you need to do is run from the command line:



php artisan migrate

Then, if you have already done so, run the following from the command line:



npm install

And then of course, run:



gulp

I built this command for a number of reasons. I felt that having an artisan command generate the code and locate it where I would normally put things was a big advantage over setting up a package that would reside in the vendor folder. I like having just one location for my controllers, etc.

Another advantage is that I’m forced to keep the templates up-to-date. If I pulled down an archived template, for example, I wouldn’t be getting the latest version of Laravel. Sure, you can run composer update, but that doesn’t update the files that reside in your app folder.

And finally, I felt it was important to be able to seamlessly integrate the other commands that Foundation Maker provides. For example, one of those commands, make:exception, allows me to create exceptions and their corresponding views with a single command. The social-app template has a Handler.php file that makes it easy for me to integrate the new exceptions.

Thanks to everyone who has and is supporting my work. I don’t have a donate button, but if you would like to contribute, you may do so by buying one of my books, Laravel 5.4 For Beginners. I would really appreciate it. Shares, comments, likes, and book reviews are also greatly appreciated. See you soon.

Laravel 5.3 For Beginners Updated for Vue 2

Access all articles in sprocket icon.

Published October 23, 2016 by Bill Keck.

Laravel 5.3 For Beginners Updated for Vue 2

I’m happy to announce that Laravel 5.3 has been updated to use Vue 2.0.1, which is the current release of Vue.js. I’ve also added a couple of chapters that cover basic and advanced use of Foundation Maker, a free artisan plugin, giving you new artisan commands for code generation.

Updates to the book are free for the life of the book, just log in to your Leanpub.com account, and pull down the latest copy.

The update to Vue 2 was a hectic one for me, it came just as I released the first version of Foundation Maker, so I really had to scramble to not only update the plugin, but also the book.

One issue that came up was that I was unsuccessful in trying to update an earlier version of Laravel, 5.3.10. For some reason I couldn’t get that to work with Vue 2, so I ended up pulling a new install of Laravel, which was on version 5.3.18. Laravel started shipping Vue 2.01 as of Laravel version 5.3.16.

I have quite a few readers who will be caught in the transition, which is why I’m talking about it here. If you are not yet to chapter 11, and you are working with an install of Laravel that is below 5.3.16, then I would recommend doing a fresh install, and quickly copying the work you have already done into the new version. Otherwise the code from chapter 11 on will not work. Sometimes updating is a bit of a pain, but it’s worth it and you will not be disappointed. In the book, we build a fully searchable, sortable, and paginated data grid using Vue 2.

If you want to check the version of Laravel you are using, you can run the following artisan command:



php artisan -V

Staying current on a new release like Vue 2 is very important, in my opinion. There’s no sense in learning a new javascript framework if you are learning on a version that is already outdated. So that was a huge motivator for me to put in the long days and nights to get this update out to you.

The book is now over 700 pages in length. For those unfamiliar with the book, we cover the basics of REST with a front-end and back-end sample app, Socialite and Facebook one-click registration and login, Image management, admin access control, data grids with Vue 2, Foundation Maker, and charts with Charts.js and Vue.js. The book starts at the beginner level and moves towards a more intermediate level with Elixir, node.js and vue.js.

Thanks to everyone who has and is supporting my work. I don’t have a donate button, but if you would like to contribute, you may do so by buying one of my books, I would really appreciate it. Shares, comments, likes, and book reviews are also greatly appreciated. See you soon.