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

On open sourcing Blender

Original – by Freek Van der Herten – 3 minute read

At Spatie we use a homegrown Laravel template called Blender. It's being used on nearly all our projects. When starting with a greenfield project we take a copy of Blender and make project specific changes in that copy. We built it because we want maximum flexibility and don't want to be hampered by…

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.

A pjax middleware for Laravel 5

Original – by Freek Van der Herten – 1 minute read

A few days ago Jeffrey Way published an interesting lesson on how to integrate pjax with Laravel. Pjax is jquery plugin that leverages ajax to speed up the loading time of webpages. It works by only fetching specific html fragments from the server, and client-side updating only certain parts of the…

Read more

A Fractal service provider for Laravel

Original – by Freek Van der Herten – 1 minute read

Today I released a new package called laravel-fractal. It provides a Fractal service provider for Laravel. If you don't know what Fractal does, take a peek at their intro. Shortly said, Fractal is very useful to transform data before using it in an API. Using Fractal data can be transformed like…

Read more

Redirect every request in a Laravel app

Original – by Freek Van der Herten – 1 minute read

I recently had to redirect every single request in a Laravel app. You might think that would be as easy as this: Route::get('/', function() { return redirect('https://targetdomain.com'); }); But that'll only redirect the "/" page. All other requests will return a 404.…

Read more

A middleware to check abilities on the route level

Original – by Freek Van der Herten – 1 minute read

Laravel's native authorization functionality allows you to define abilities a user can have. There are multiple ways to check if a user has a certain ability: via the facade, via the user model, within blade templates and within form requests. What Laravel doesn't provide out of the box is a…

Read more

A package to add roles and permissions to Laravel

Original – by Freek Van der Herten – 1 minute read

With the release of Laravel 5.1.1 last week the framework gained some nice Authorization features. It provides an easy way to define abilities (aka permissions). Checking if a user has certain abilities is very simple as well. The code powering authorization is a thing of beauty. If you're a…

Read more

Making string concatination readable in JavaScript

Original – by Freek Van der Herten – 1 minute read

At Laracon EU Frank De Jonge gave a talk on modern JavaScript development. It struck a cord with me. On a project I'm currently working on I'm learning a bit of React and using some of these neat new JavaScript features. One of those features is called template strings. It allows you do make string…

Read more

Laracon EU 2015 recap day two

Original – by Freek Van der Herten – 4 minute read

Today the second day of the Laracon EU took place in Amsterdam. Like yesterday there were a lot of interesting speakers. Jessica Rose started with a great talk on imposter syndrome. Impostor syndrome is the feeling that you don't know what you're doing, while everyone else is getting on fine. She…

Read more

Laracon EU 2015 recap day one

Original – by Freek Van der Herten – 3 minute read

I'm having the pleasure to attend Laracon EU. The event is located at a truly beautiful venue: the Royal Tropical Institute in Amsterdam. Today was the first day of the conference. Matt Stauffer kicked off Laracon EU with a great talk about empathy. He explained why it is a key trait that every…

Read more

Making string concatenation readable in PHP

Original – by Freek Van der Herten – 2 minute read

Probably all PHP developers know how to concatenate strings. The most popular method is using the .-operator. For small concatenations using this operator works fine. When lots of strings or variables need to be combined it can become cumbersome. Here's an example: $logMessage = 'A…

Read more

View disk space usage on Ubuntu

Original – by Freek Van der Herten – 1 minute read

A while ago, a disk of one of our DigitalOcean droplets had almost no free space. Ncdu (NCurses Disk Usage) is a command line tool to view and analyse disk space usage on Ubuntu. It can be installed with this command: sudo apt-get install ncdu Once it has been installed it can be launched by simply…

Read more

Further refactoring code for readability

Original – by Freek Van der Herten – 2 minute read

A few days ago Dylan Bridgman published a post on writing highly readable code. He cleaned up a truly horrible piece of code. The code was further improved the very same day by Ryan Winchester. I believe the code can be improved still. Read the mentioned blog posts to see which code we are going to…

Read more

Using Algolia in Laravel

Original – by Freek Van der Herten – 2 minute read

Algolia is a hosted service that makes advanced searching very easy. It's well documented and lightning quick. You can see some impressive examples on their site. Artisans probably know that Jeffrey Way recently published a series on Algolia. Earlier this year I made a package to easily work with a…

Read more

Laravel-medialibrary hits version 3

Original – by Freek Van der Herten – 3 minute read

Not a month has gone by since v2 of the laravel-medialibrary package got released. If you're not familiar with it: the package provides an easy way to associate files with Eloquent models. Though I was quite happy with the improvements made over v1 there were some things that bothered me. Take a…

Read more

What would make Laravel Forge even better

Original – by Freek Van der Herten – 2 minute read

A little over a year ago Laravel Forge was launched. At Spatie we currently have 60 servers that are provisioned by and administered using it. I'm assuming we still hold the biggest Forge-account. By this time next year the number of servers will probably be higher. So yeah, I'm a very happy…

Read more

Upload large files to S3 using Laravel 5

Original – by Freek Van der Herten – 1 minute read

Chris Blackwell yesterday published a tutorial on how to upload files to S3 using Laravel. This is the code he used (slightly redacted): $disk= Storage::disk('s3'); $disk->put($targetFile, file_get_contents($sourceFile)); This is a good way to go about it for small files. You should note…

Read more

Our open source software

Original – by Freek Van der Herten – 1 minute read

The past few months my colleagues and I invested quite some time on creating open source software. Because there now are a lot of packages under the Spatie-vendor name, we decided to put a nice overview on our website. Obviously these packages benefit the community, but there are a lot of advantages…

Read more

Convert a pdf to an image using PHP

Original – by Freek Van der Herten – 1 minute read

Converting a pdf to an image is easy using PHP, but the API kinda sucks. $imagick = new Imagick('file.pdf[0]'); $imagick->setImageFormat('jpg'); file_put_contents($pathToImage, $imagick); The pdf-to-image-package aims to fix that. Here is the equivalent code: $pdf = new…

Read more