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

A package that adds resource links to your Laravel API resources

Original – by Freek Van der Herten – 3 minute read

At Spatie we have several projects where the UI is rendered using JavaScript (we're big fans of Inertia). The backend and routes are defined in the Laravel app. The backend sends information to the frontend using API resources.

We often add the available routes the frontend can use as links property on the resource. To avoid having to add all routes manually, my colleague Ruben released a package, called laravel-resource-links that can automatically add resource links to the API resource.

In this post, I'd like to introduce the package to you.

Read more

Event store optimizations in laravel-event-sourcing

Original – by Freek Van der Herten – 5 minute read

About a year ago, we released laravel-event-projector. It focused on adding projectors, an important concept in event sourcing, to Laravel.

After the release of the package, we continually kept improving it. We added aggregates, a way to test those, a brand new section in the our documentation that explains event sourcing from scratch, and DX improvements all across the board.

We now feel confident that the package is a good starting point for getting started with event sourcing in Laravel. That's why we're renaming the package to laravel-event-sourcing.

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.

Watch the Flare reveal live

Original – by Freek Van der Herten – 2 minute read

These past eight months Marcel Pociot, me and our teams at Beyond Code and Spatie have been working on a secret project called Flare. We believe that Flare is going to change the way you work with Laravel. To be kept in the loop subscribe to our mailinglist.

We are going to launch it this Friday at Laracon EU at 16.30 local time (15:30 CET). The Laravel News YouTube channel will live stream the launch. You can watch the stream right below.

Read more

Supercharging common controllers

Original – by Freek Van der Herten – 2 minute read

From time to time our team needs to create fairly complicated CRUD interfaces from scratch. While this isn't rocket science, there surprisingly aren't that many good resource out there on how to do this. That's why our team dove in and published a couple of packages that can help create modern CRUD…

Read more

Implementing event sourcing: testing aggregates

Original – by Freek Van der Herten – 4 minute read

Earlier this year we released v2 of laravel-event-sourcing. This package is probably the easiest way to getting started with event sourcing in Laravel. A significant feature of v2 was the addition of aggregates.

Today we released another new version of the package that adds test methods. These methods allow you to verify if the aggregate behaves correctly. In this post, I'll show you an example and explain how the test methods are implemented.

These test methods were inspired by the awesome testing methods Frank De Jonge made in his Eventsauce package.

Read more

How to add webmentions to a Laravel powered blog

Original – by Freek Van der Herten – 8 minute read

The comment section of this blog used to be powered by Disqus. At its core, Disqus works pretty well. But I don't like the fact that it pulls in a lot of JavaScript to make it work. It's also not the prettiest UI. I've recently replaced Disqus comments with webmentions. If you reply to, like or…

Read more

Going serverless with Hugo and Netlify

Original – by Freek Van der Herten – 5 minute read

Our team releases a lot of open source packages. All of our packages are well documented. For the smaller packages, we use a simple readme on GitHub. The bigger packages, like medialibrary and event projector get documented on our documentation site. We recently moved our site from a Digital Ocean…

Read more

How to handle front-end authorization using Laravel, Inertia and TypeScript

Original – by Freek Van der Herten – 6 minute read

Recently Jeffrey Way published a video titled "Frontend Authorization Brainstorming" on Laracasts. In that video, he shows three ways of passing authorization results to the front-end.

Currently I'm working on a big project that uses Inertia, React and TypeScript. In this blog post, I won't cover those things in detail, but I'd like to show you have we, using those technologies, pass authorization (and routes) to the front-end.

Read more

Sending and receiving webhooks in Laravel apps

Original – by Freek Van der Herten – 8 minute read

A webhook is a mechanism where an application can notify an other application that something has happened. Technically, the application sends an HTTP request to that other application. In this blog post, I'd like to introduce you to two packages that we recently released. The first is laravel-webhook-server, which allows you to send webhook requests. The second one is laravel-webhook-client, which makes it easy to receive those webhook request.

Read more

A package to control the flow of time

Original – by Freek Van der Herten – 2 minute read

Imagine you're building that your app can notify your user, but you don't want to send more than one notification in a timeframe of five seconds. How are you going to test the time aspect? Do you have to create a test that takes five minutes?

Read more

Refactoring to actions

Original – by Freek Van der Herten – 6 minute read

In our recent projects at Spatie, we've started using a concept called "actions". It keeps our controllers and models skinny. It's a straightforward practice. In this blog post, I'd like to explain it to you.

Read more

Caching the entire response of a Laravel app

Original – by Freek Van der Herten – 5 minute read

When a request comes in your app will return a response. To create that response, your application has to do some work. Most likely queries will execute. This all takes some time. Wouldn't it be nice if the same request comes in, we can return the response the application has constructed previously?

Read more