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

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

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.

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

A new version of the medialibrary package

Original – by Freek Van der Herten – 1 minute read

When starting out with Laravel I made a medialibrary to associate uploaded files with models. In our custom made cms we use the medialibrary to for example associate articles with images. In short the medialibrary could: associate files with models generate thumbnails and other derived images from…

Read more

The first PHP Antwerp meetup

Original – by Freek Van der Herten – 1 minute read

Earlier tonight the first PHP Antwerp meetup was held. The event was organised by Dries Vints of BeatSwich. I was the first speaker and talked a little bit about Satis and how we use it at Spatie. You can view the slides on Speakerdeck. The big talk of the evening was delivered by Mitchell van…

Read more

A trait to optionally abort a Laravel app

Original – by Freek Van der Herten – 1 minute read

Inspired by Edd Man's post on optional value control-flows I made a small Laravel package to optionally abort your application. The package provides a Spatie\OrAbort\OrAbort-trait that can be used on any class you want. All the methods of the class will gain orAbort-variant. When the original…

Read more

A Laravel package to easily add paginated routes

Original – by Freek Van der Herten – 1 minute read

Laravel offers a nice way to add pagination. As far as your routes are concerned you don't have to do a thing. It just works out of the box. Unfortunately the generated url's are pretty ugly: http://example.com/news?page=2 What we want are url's that look like this: http://example.com/news/page/2…

Read more

Creating packages

Original – by Freek Van der Herten – 2 minute read

Prosper Otemuyiwa recently wrote an article on how to create Laravel 5 packages on his blog. Although his approach is entirely valid and may suit you well, I work a little differently when creating a new package. First, I create a new GitHub repository where the package will live. In that repo I…

Read more

The benefits of creating packages

Original – by Freek Van der Herten – 1 minute read

In the last few months various little parts of our custom built CMS were made available as composer installable packages. Though creating a package takes some time, there are many benefits: my colleagues and my future self can benefit from the same documentation that is written for the consumers of…

Read more

Manage newsletters in Laravel 5

Original – by Freek Van der Herten – 1 minute read

A few hours ago I tagged version 1.0.0 of a my new package: laravel-newsletter. It provides a very easy way to interact with email marketing services. Or maybe I should simply say MailChimp, as it is currently the only supported supported service. After you install the package (un)subscribing an…

Read more

A medialibrary package for Laravel 5

Original – by Freek Van der Herten – 3 minute read

At Spatie all our greenfield projects are powered by custom built CMS based on Laravel 5. An important part of the CMS is the medialibrary-component. It handles how uploaded files are associated with models. My intern and I recently took the time to release our medialibrary as a package on GitHub.…

Read more