Is Laravel Right For Enterprise Development

Access all articles in sprocket icon.

Published May 12, 2017 by Bill Keck.

Is Laravel Right For Enterprise Development

In the most recent episode of the Laravel Podcast, they spend some time talking about whether or not Laravel is right for enterprise development.

The question, as I see it, breaks out across handling two main points:

  • Scale
  • Complexity

We’ll start with the scale issue.  In the podcast, Jeffery Way makes the argument that most applications will never scale to the point of running into scalability issues with Laravel.

Let me just say upfront, I’m a huge fan of Jeffery Way and watch Laracasts religiously.  At the same time, I disagree with his thinking on scale for the same reason I wouldn’t recommend ignoring n+1 problem simply because there aren’t enough users on the application to create a problem.

In most cases, everyone involved in an enterprise will do everything they can to drive as much traffic to the app as possible, so it’s much better to be ready for it than not.

As I see it, this question is really not about Laravel, but about PHP in general and how you handle state. Personally, I love handling state through sessions, it’s just so easy to work with.  By using AWS and Redis, you should be able to handle quite a lot of scale, without having to go to stateless auth.  I should also note that Laravel does support stateless auth, though I have never personally used it.

Exactly how much scale you can get to using sessions is beyond my level of experience, but it’s worth noting that Facebook was built with PHP, and they have certainly achieved an amazing level scale.  But like I said, I’m not an expert on their architecture, so I’ll just point to a reddit post, and you can check out some opinions about PHP there.

Since PHP 7 was released, it alleviate a lot of the anxiety around using PHP because of the improved speed and performance.

In terms of handling complexity, I know from personal experience that Laravel is a pleasure to work with.  Imagine you have an application with over 500 tables, numerous apis, cron jobs, and extremely dynamic frontend requirements that lean heavily on javascript.

Laravel is perfect for that.  Laravel has a super-solid architecture that is easy to comprehend and work with.  It is so well thought out as a framework that it touches nearly every requirement you are going to come across.  And the thing is it doesn’t just provide all of your foundational code, it does it extremely well.

In the Podcast, Taylor Otwell, the author and founder of Laravel, talked about some reasons why someone might not like the framework, including:

  • objecting to the marketing of an open source project
  • personal dislike of Taylor himself

Let’s deal with the personal dislike of Taylor.  I’ve been following Laravel for 4+ years.  In that time, I’ve never heard Taylor Otwell make anything resembling an unprofessional statement of any kind.  So personal dislike of the founder, which is probably rooted in jealousy,  seems like a petty reason not to use a framework.

Business that make decisions based on pettiness tend to not do well in the market.

I also don’t understand why someone would object to a highly successful open source project having a commercial ecosystem around it.

Would you rather not have Laracasts or Envoyer to work with?  Honestly, I wouldn’t enjoy programming as much as I do if it weren’t for Jeffery Way and Laracasts.  Just think about how much he brings to the space.  Is it really that objectionable that he makes a living from it?

My company uses both Laracasts and Envoyer extensively.  Laracasts also turned us onto Vue.js, which is a great Javascript framework that is used extensively by the Laravel community, and for good reason.

Envoyer provides seamless deployments of your projects, and we have found it invaluable for our releases.  We’re more than happy that Taylor Otwell is compensated in some way for providing both the service and the phenomenal Laravel framework to start with.

Laravel provides first-class documentation, as if it were a commercial product, and yet it’s free.  As the leader of a company that relies on Laravel, I’m very excited and grateful for everything they do.

Another point I’ve heard from people is that Laravel updates too often, with big releases twice a year.  That means you have to migrate if you want to keep up to date, and that can be a pain.  But would you rather update less often and incur technical debt?  Who in their right mind would want that?  Eventually you will have to address technical debt and nothing is more ugly than that…

Laravel, and it’s supporting ecosystem, is capable of powering enterprise applications.   Recently, I mentioned a cliche in one of my books, 100 Patterns For Success, where I talk about the joke from the show Silicon Valley, where an engineer says:

“I want to change the world with a beautiful architecture that maximizes code reuse and extensibility.”

Everyone says that.  Taylor Otwell actually did it with Laravel.

Thanks again to everyone who is following my work, and thanks again for all the great reviews on Laravel 5.4 For Beginners, I really appreciate it.

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.

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.

Laravel 5.3 For Beginners Book Official Release

Access all tutorials in sprocket icon.

Published September 8, 2016 by Bill Keck.

Laravel 5.3 For Beginners Book Official Release

I’m happy to announce I’ve just released my new book, Laravel 5.3 For Beginners. The book comes in at just over 620 pages, and covers a lot of ground that I did not cover in my previous Laravel books, including using Elixir and Vue.js.

The book starts out with the basics, like the previous books, and some of that will sound familiar if you read those books, but then it progresses into more intermediate code. We utilize Socialite for one-click authentication with Facebook and Github, so now we have it set up to handle multiple social providers. We have an image management trait that helps us utilize the Intervention Image package, which makes creating thumbnails very easy.

Another big difference in this book is the use of Elixir and Vue.js. I didn’t cover those in previous books because I felt they were more intermediate, and actually, Vue.js has only recently been adopted by the community to the extent that is now configured in Laravel out of the box. You will love that.

The whole Elixir implementation is easier to get going now, so we get introduced to Elixir for our asset management. But we don’t do that early in book, we save it for later, after you learn the basics.

Instead we take you step by step in building a sample application that will help you understand how the framework actually works. The early chapters are similar to my last book, but there are significant differences, mostly refinements that reflect both my personal growth as a programmer and also trends within the community. For example, while I still use the form helper for date formatting, I don’t use it for much else and we will explore the reasons for that.

Also, we are no longer using jQuery for our data grids. Instead we moved to a very robust data grid built with Vue.js, the javascript framework that is favored by so many Laravel developers, so much so, it comes setup for you out of the box, after you run npm install.

As always, I did my best to make the book comprehensive and accessible to all. Laravel is just an awesome framework, and if you are just learning, it’s a great place to start.

Thanks again to everyone who has purchased my previous books and followed this blog, I appreciate your support!

vue.js paginated datagrid powered by ajax and Laravel 5.2

Access all tutorials in sprocket icon.

Published May 9, 2016 by Bill Keck.

I’ve been working on ViewMaker, which is a free plugin for Laravel artisan, and one of my main objectives with the make:foundation command was to stand up a working datagrid that was fed by an ajax call with Laravel.

I worked really hard to make a paginated set of data results that has column sorts and complete control over the pagination. The pagination navigation features a page by page link, previous and next buttons that only show when appropriate, first and last buttons, and a go to page input and button.

I also added an ajax-powered search box that queries on a keyup event. This produces column sortable, paginated results as well. All of this is done with vue.js, which is a javascript library that many Laravel developers are using these days.

One of the things I really struggled with was I couldn’t find a working example to follow. Luckily, I had bought The Majesty of View recently, which is an excellent book on vue. The book is really great for getting started with vue, but it wasn’t explicit enough with its pagination example for me to use it for my laravel datagrid.

Instead I used the datagrid example on vuejs.org as a starting point and built it up from there. Truth be told, I hit up one or two of the enterprise developers at work for some hints too, since I’m relatively new with vue. There’s nothing quite like working on a datagrid to move your js skills along.

Since I followed the datagrid from the vue.js example, I built it with a component, so this was a real crash course in vue.js. You can check out my work by installing the ViewMaker plugin, which will let you create a working version of the datagrid, along with the api controller and everything else you need in under a minute. Check out the docs on ViewMaker if you want to learn how to do that.

I’m going to do a deep dive tutorial on all this, which will probably appear in one of my books, since it’s too much for this blog and wordpress doesn’t let me publish js code snippets.

If you do play with ViewMaker’s datagrid, keep in mind that you need to run vue.js not vue.min.js, otherwise you don’t get important warnings and error messages. Also Chrome has a dev tools plugin for vue, but you also need to be using the not minified version to use that.

I’m going to be building more features into ViewMaker, which I will be announcing on this blog. My goal is to make ViewMaker an artisan plugin that you can’t live without.

Click on the sprocket icon at the top of the page to see all my Laravel articles and tutorials. Please comment, share, like and review if you can, thanks.

I don’t have a donate button, but If you would like to support my work and learn more about Laravel, you can do so by buying one of my books, Laraboot: laravel 5.2 For Beginners, I really appreciate it.

ViewMaker 3.1 released for Laravel 5.2

Access all tutorials in sprocket icon.

Published April 29, 2016 by Bill Keck.

ViewMaker 3.1

**update 5/4/2016 ViewMaker 3.2 released with Vue.js datagrid column sort and pagination**

As most who follow this blog know, I’ve been working on an artisan plugin named ViewMaker. The project was inspired by my simple and trivial trait-maker artisan plugin, which I made mostly to demonstrate how to make a custom artisan command and to also help myself remember the trait syntax. It was a good learning experience.

Once I had that plugin built, I thought, wouldn’t it be cool to do the same thing for views? So I banged up a quick version that let you input a model name, the name of your master page, and a template type, and with that one command, create up to 4 views, including index, create, edit, and show. It was just a simple command to stub out your views, so if you ran the following, for example:



php artisan make:views widget master basic

You would get views for a widget model, that extended a master page named master, and used the basic template type, which included index, create, edit, and show. If you chose the ‘dt’ or ‘vue’ template, you would get everything you need to display a working datagrid on your index page. The dt template is an implementation of jquery datatables and the vue template is vue.js data grid implementation.

In the first version, you still had to manually create your model, route, controller, migration, etc., so I put together extensive documentation on the conventions used, so users would know what they needed to do to actually render the views that ViewMaker creates.

I quickly realized though, that it was possible to make a lot of mistakes and typos, and again asked myself, wouldn’t it be cool if you could create the supporting route, controllers, migration and model with one command?

As I thought about it, I also realized that at the same time, I could create a factory method and unit test, so I came up with this concept of a foundation, which let’s you stand all that up, including the views, with one simple command. If we use the widget model example, we could do the following:



php artisan make:foundation widget master dt

This will give you everything you need for a working datagrid:

  • model
  • controller
  • api controller (if it does not yet exist)
  • migration
  • test
  • appropriately-named view folder
  • index view
  • create view
  • edit view
  • show view

In addition to creating those files, it also appends to the following files:

  • routes.php
  • ModelFactory.php
  • ApiController (if it already exists)

Now that’s a lot for a single command to do, this is a real time-saver. However, for all this to work properly, it still requires certain things
like a jquery dependency and a meta tag for csrf token in your master page.

I saw that as too easy of a point for failure, so I created the make:master command:



php artisan make:master master Demo

The above command will make a layouts folder in your views folder and place the following within it:

  • master (you give it your name, in this case we called it master)
  • meta partial
  • css partial
  • scripts partial
  • bottom partial
  • nav partial
  • shim partial

So that includes everything you need to use the make:foundation or the make:views command successfully. Additionally, it inserts the application name, in this case Demo, into the navbar-brand class in the nav partial. If you leave off that input, it defaults to Demo.

All of the templates are built around a single field name, the model_name field, so you can quickly prototype your models. And since only one field is provided, you don’t have to do a bunch of deleting to get rid of unwanted fields. You can quickly add your own columns to the migration, add them to the $fillable property on the model, and add them to the controller methods. So this is just the right amount of scaffolding to help you move along quickly.

Compound model names are also supported, so if you have a BigWidget model, you can still use make:foundation to create it.

For those who are unfamiliar with either jquery datatable or vue.js, a working prototype is a great place to start, and you can get that easily by running the make:master and make:foundation commands.

Installing ViewMaker is super-simple, just run the following from the command line:



composer require evercode1/view-maker

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



Evercode1\ViewMaker\ViewMakerServiceProvider::class,

Then run:



php artisan list

Then you will see the new commands in your list:

  • make:crud
  • make:foundation
  • make:master
  • make:views

I have extensive documentation, including a make:foundation workflow tutorial on the Github page. The best way to get familiar with what it does is to create a fresh install of Laravel, then try the make:master and make:foundation commands. You can follow the workflow tutorial and you will see how easy it really is.

I have plans to continue to expand the plugin with new features, so don’t be surprised if you see it offer new commands and parameters in the future. If you have it installed, you will get the latest version every time you run composer update.

Click on the sprocket icon at the top of the page to see all my Laravel articles and tutorials. Please comment, share, like and review if you can, thanks.

I don’t have a donate button, but If you would like to support my work and learn more about Laravel, you can do so by buying one of my books, Laraboot: laravel 5.2 For Beginners, I really appreciate it.

Bonus Material for Laraboot: Laravel 5.2 For Beginners Released

Access all tutorials in sprocket icon.

Published April 3, 2016 by Bill Keck.

Bonus Material for Laraboot: Laravel 5.2 For Beginners Released

Chapter 11: How to make a custom Artisan command

I’m happy to announce the release today of another chapter of bonus material for Laraboot: Laravel 5.2 For Beginners. This is a quick chapter to knock out how to create a custom artisan command.

All updates and bonus material are free to anyone who has purchased the book, just log into your leanpub account and pull down the latest copy.

I found myself in a slightly embarrassing situation where I was demonstrating traits and forgot to include the php open tag in the file. On top of that, I messed up the folder location. When that happened, I realized how much I love the code generators from Artisan, which help prevent these kinds of mistakes.

With artisan, a simple command line instruction gets me a perfectly formatted controller, model, middleware, request, event, etc., whenever I need it. It’s just awesome.

So I thought, wouldn’t it be cool to have an artisan command that stubs out a trait? And then I thought this would make a great tutorial as well. However, when I implemented, it was just too much for the blog. As it is, it ended up being 15 pages in the book. While none of it is especially complicated, I was very thorough in my explanations. That brings the page count to the book to 496 pages.

Anyway, writing the custom artisan command was a wonderful experience because it showed me once again how easy and intuitive Laravel really is. The docs clear and helpful. I was amazed that it that it works so well with so little effort.

That’s not the first time I’ve fallen in love with the framework. It seems to happen again and again. Laravel is the leading PHP framework and it deserves to be.