Laravel is a great framework with fantastic documentation - but it can be a little overwhelming. There are so many ways to accomplish the same task. How do you know which way is the best?

This course will break down the most important things to learn about Eloquent, the ORM that is a central part of Laravel. There are 14 Lessons that take about 10-15 minutes each to accomplish.

At the end of the three weeks you will have a solid workflow and be able to use the Artisan tools to quickly design and create new applications.


Julien Pauli, PHP contributor and release manager, details what changed between PHP 5 and PHP 7, and how to migrate and make effective use of the language optimizations. All statements are documented with specific examples and Blackfire profiles. Fourth episode: References mismatch generating no overhead.

The following is the 4th episode of our blog series on PHP 7 performance improvements, detailed by Julien Pauli PHP Contributor and Release Manager. We will update this introduction with links to all other articles when they are published.

Read episode 1: Packed arrays

Read episode 2: ints/floats are free in PHP 7

Read episode 3: Encapsed strings optimization

Reference mismatch happens when you pass a non-ref variable to a function argument passed-by-ref, or the opposite. Something like this:


I want to look at two PHP functions: eval and exec. They’re so often thrown under the sensible-developers-never-use-these bus that I sometimes wonder how many awesome applications we miss out on.

Like every other function in the standard library, these have their uses. They can be abused. Their danger lies in the amount of flexibility and power they offer even the most novice of developers.

Let me show you some of the ways I’ve seen these used, and then we can talk about safety precautions and moderation.


There are tons of reasons to do laravel development on Homestead.  And though you might be convinced to use it, it is not always very simple to be “up and running” within minutes. Laravel’s official documentation on installing Homestead on Windows and Mac is pretty clear. But sometimes, the process is not as straight forward as shown in the documentation.  There are a lot of 3rd party software involved and sometimes they create problems.  I will be guiding you through the installation and configuration of Laravel Homestead while preventing the common errors from occurring.




  • Added before_or_equal and after_or_equal validation rules (#16490)
  • Added fluent builder for SlackMessageAttachmentField (#16535, db4879a)
  • Added the possibility to set and get file permissions in Filesystem (#16560)

PHP frameworks can really speed up your development process. They provide you with a stable foundation to start from, so that you can spend time developing the important parts of your application rather than reinventing the wheel.

But the proliferation of different PHP frameworks also means that there's a learning curve involved. As well as learning PHP, you need to learn the workings of each framework, or at least of the ones you're planning to use.


PHP 7.1, the new minor version of PHP will be released on December 1st, with a number of new features, changes, and bug fixes. While we wait for it's release, let's look at some of the awesome features in PHP 7.1. Like,

  • iterable pseudo type
  • Closure from callable
  • Square bracket syntax for list()
  • Support for keys in list
  • Class constant visibility
  • Nullable types
  • Void functions
  • Catching Multiple Exception Types

I will also link to the corresponding RFCs for your reference.


It’s widely accepted that high-level integration tests alone do not make for a good test suite. Ideally each individual component of your application should have unit tests, which test that component in isolation. These unit tests are usually much quicker to run, making it easier to practice test-driven development. However, it can sometimes be hard to grasp how to test that one component on its own.

The other day I had an issue with several middleware classes for a Laravel application and I wanted to verify that they were working as expected. Sounds like a job for dedicated unit tests, but I hadn’t tested custom middleware in isolation before, and figuring out how to do so took a while.


As we already wrote that "Code Reuse By Inheritance" has lots of problems and we consider it a code smell. You should always aim to use Dependency Injection, most likely Constructor Injection. But with test cases in PHPUnit we cannot do this because we have no control about how and when our test cases are created. There are a similar problem in other frameworks, like we discussed in "Object Lifecycle Control". We also blogged about traits as a Code Smell, but let me show and explain why they might be fine to use in your test cases.

So in PHPUnit it is common to reuse code by inheritance. Even by now we often create some base class providing common functionality. This works fine and is OK if this really defines an "is a"-relationship. Let's continue with an example from our Page Object test repository. The patterns described here are usually not required for Unit Tests (which you should always also write) but mostly for integration or functional tests.


Refactoring to Collections is a great book by Adam Wathan where he demonstrates, how you can avoid loops by using collections. It sounds great from the beginning, but you need to practice it, in order to be able to use it in your own projects. This is why I refactored some of my older projects. I want to share these examples today with you.

Note: Code examples are from Laravel projects where collections are built-in.

Example 1

Here I needed to built a string from an array to create an unique cache key for given search filters. When you first look at the before and after examples, you could question if the collection version is a better choice here. This is because it looks a little bit more complex. But this is just the first impression. The collection version of this code has some great benefits:

  • as always with collections, the code tells you more about what is happening
  • it separates steps and helps you do one thing after the other
  • it is easier to add more functionality like adding a filter



Laravel (474) tutorial (267) php (238) packages (88) javascript (84) github (71) video (68) laravel 5 (65) Laravel 5.2 (49) php 7 (48) web development (42) laravel 5.3 (40) database (36) vue.js (36) news (34) oop (34) authentication (33) guide (33) tips (31) eloquent (28) AngularJS (23) laracasts (23) api (22) composer (22) release (21) Angular 2 (18) middleware (16) MySQL (16) phpstorm (16) testing (16) authorization (15) validation (15) development (14) model (14) overview (14) routing (14) web application (14) EcmaScript 6 (13) Laravel 5.1 (13) ES6 (12) homestead (12) lumen (12) artisan (11) framework (11) spark (11) tdd (11) typescript (11) unit test (11) blade (10) image (10) mail (10) performance (10)