In this section you can read posts I've written myself.

When empty is not empty

Original – by Freek Van der Herten – 2 minute read

Recently when I was working on a project I got some strange results when using the empty function. Here's what I was debugging. I've simplified the code a bit to share with you. var_dump( $person->firstName, empty($person->firstName) ); This was the result: string(5) "Freek"…

Read more

Automatically close stale issues and pull requests

Original – by Freek Van der Herten – 5 minute read

At Spatie we have over 180 public repositories. Some of our packages have become quite popular. We're very grateful that many of our users open up issues and PRs to ask questions, notify us of problems and try to solve those problems, ... Most of these issues and PRs are handled by our team. But…

Read more

Stay up to date with all things Laravel, PHP, and JavaScript.

You can follow me on these platforms:

On all these platforms, regularly share programming tips, and what I myself have learned in ongoing projects.

Every month I send out a newsletter containing lots of interesting stuff for the modern PHP developer.

Expect quick tips & tricks, interesting tutorials, opinions and packages. Because I work with Laravel every day there is an emphasis on that framework.

Rest assured that I will only use your email address to send you the newsletter and will not use it for any other purposes.

Doing less

Original – by Freek Van der Herten – 6 minute read

Last week I stumbled upon this article titled "GitLabbers share how to recognize burnout". It list these points to recognize burnout: You're constantly tired You no longer enjoy things Your job performance suffers Your relationships are strained (You have a hard time remembering…

Read more

laravel-medialibrary v7 has been released ?

Original – by Freek Van der Herten – 14 minute read

laravel-medialibrary is a powerful package that can help handle media in a Laravel application. It can organise your files across multiple filesystems, generate thumbnails, optimize images and much much more. At Spatie we use this package in nearly every project. The last few months our team has…

Read more

Today we hit 10 million PHP package downloads

Original – by Freek Van der Herten – 2 minute read

For the past few years Spatie, the company where I work, has released many Laravel and PHP packages. Those packages are primarily built to be used in our own projects. We do not operate in a void. We have a community around us. They use our work. They help to make our packages better by submitting…

Read more

Using Content Security Policy headers in a Laravel app

Original – by Freek Van der Herten – 5 minute read

By default all scripts on a webpage are allowed to send and fetch data from and to any site they want. If you think about it, that's kinda scary. Imagine that one of your JavaScript dependencies would send all keystrokes, including passwords, to a third party website. That would be pretty bad. In…

Read more

A package to assign statuses to Eloquent models

Original – by Freek Van der Herten – 2 minute read

Imagine you want to have an Eloquent model hold a status. It's easily solved by just adding a status field to that model and be done with it. But in case you need a history of status changes or need to store some extra info on why a status changed, only adding a single field won't cut it. To handle…

Read more

How to upgrade from PHP 7.1 to 7.2 on MacOS using Homebrew

Original – by Freek Van der Herten – 1 minute read

PHP 7.2 was released almost two months ago. I decided to wait a bit until a stable version of Xdebug with PHP 7.2 compatiblity was available. And that happened yesterday with the release of Xdebug 2.6. I'm on MacOS and use brew to install stuff. Upgrading from PHP 7.1 to 7.2 is laughably easy. These…

Read more

How to send a "trial expiring soon" mail in Laravel Spark

Original – by Freek Van der Herten – 6 minute read

I'm currently building a webapp named Oh Dear: an easy to use and beautiful website monitor. It has recently gone into it's beta phase. At the moment of writing everybody can register a new account. After you've registered you'll start your trial period of 10 days. Oh Dear is built on top Laravel…

Read more

Handling CORS in a Laravel application

Original – by Freek Van der Herten – 5 minute read

Recently we released laravel-cors. This package can add the necessary CORS headers of your Laravel app. In this post I'd like to give a quick explanation of what CORS is and how you can use the package. What is CORS Imagine that all JavaScript code for domain X running in a browser would be able to…

Read more

The story behind our open source efforts

Original – by Freek Van der Herten – 15 minute read

This post was first published on 24daysindecember.net Chances are that you've never heard of my company Spatie. We specialise in creating Laravel applications for our clients. Our team is rather small: we consist of only 6 developers and one manager. On first glance we are just a web agency like…

Read more

An async map function

Original – by Freek Van der Herten – 3 minute read

Laravel has an excellent Collection class that has many useful operations. The class is also macroable. This means that you can add function to it at runtime by calling macro on it and passing a name and a closure. In our projects we tend to code up the same macro's over and over again. That's why…

Read more

Laravel-medialibrary v7 preview: media collections

Original – by Freek Van der Herten – 5 minute read

laravel-medialibrary is a package that can help handle media in a Laravel application. It can organise your files across multiple filesystems, generate thumbnails, optimize images and much much more. Like mentioned before on this blog my team and I are currently creating a new major version, v7,…

Read more

Laravel-medialibrary v7 preview: multi file downloads

Original – by Freek Van der Herten – 4 minute read

laravel-medialibrary is a powerhouse package that can help handle media in a Laravel application. It can organise your files across multiple filesystems, generate thumbnails, optimize images and much much more. My team and I are hard at work creating a new major version, v7, that adds a lot of…

Read more

Symfony now has an improved dump function

Original – by Freek Van der Herten – 2 minute read

Let's talk a little bit about Symfony's dump function. It's part of their VarDumper component. The function can dump a variable to the screen or browser in a nicer format than PHP's native var_dump. In the recently released Symfony 3.4 and Symfony 4 the function got a nice little improvement that…

Read more

murze.be turns three

Original – by Freek Van der Herten – 2 minute read

Three years ago I started this blog to share my bookmarks and interesting links with fellow developers. Like on the previous anniversaries I'd like to share some cool statistics from the past 12 months. For the period spanning from end november 2016 until end november 2017 my little blog served 591…

Read more

Reducing the size of a css file

Original – by Freek Van der Herten – 2 minute read

PurgeCSS is a tool that can reduce the filesize of a CSS file. It does this by removing any css classes that are not used. It can detect which CSS classes are used by scanning the source files of your application. In this tweet Jonathan Reinink shared how it can be configured in Laravel Mix: ???? I…

Read more

On migrating my blog from WordPress to a Laravel application

Original – by Freek Van der Herten – 12 minute read

Regular visitors will have noticed that last week this blog got a new coat of paint. This new layout isn't just a new WordPress theme. Things have changed on the backend as well. Previously my blog was powered by WordPress. I've migrated it to a custom built Laravel app. That app is open sourced.…

Read more