Seb De Deyne
PHP 7.1 introduced a new syntax for the list()
function. I’ve never really seen too much list()
calls in the wild, but it enables you to write some pretty neat stuff.
This post is a primer of list()
and it’s PHP 7.1 short notation, and an overview of some use cases I’ve been applying them to.
Read more
A little bash script to run tests when a file has been changed.
Read more
The gist of snapshot testing is asserting that a set of data hasn’t changed compared to a previous version, which is a snapshot of the data, to prevent regressions. The difference between a classic and an is that you don’t write the expectation yourself when snapshot testing.
When a snapshot assertion happens for the first time, it creates a snapshot file with the actual output, and marks the test as incomplete. Every subsequent run will compare the output with the existing snapshot file to check for regressions.
Snapshot testing is most useful larger datasets that can change over time, like serializing an object for an XML export or a JSON API endpoint.
Read more
When admins create or update a news item—or any other entity—in our homegrown CMS, a url slug is generated based on it’s title. The downside here is that when the title changes, the old url would break. If we wouldn’t regenerate the url on updates, edited titles would still have an old slug in the url, which isn’t an ideal situation either.
Our solution: add a unique identifier to the url that will never change, while keeping the slug intact. This creates links that are both readable and unbreakable.
Read more
Vue 2.0 introduced it’s own virtual DOM implementation. At first sight, this doesn’t seem to have a large effect on the way you write templates.
Read more
When building a website for a client that wants to be able to manage content, Laravel’s language files aren’t ideal since you can’t edit them without diving into a bundle of text files. We recently decided to drop all the lang files in our custom CMS in favor of persisting translations in the database, which allows us to build a custom interface for managing them.
This post is a quick overview on overwriting Laravel’s default translation loader, which means you can keep using the lang
method while fetching the translations from a database. Writing a custom loader is easier than it sounds. First we’ll set up our translation models, then we’ll write our loader, and finally register it in our application.
Read more
Dynamic languages allow us to pass anything as a parameter without requiring a specific type. In turn, this means we often need to handle some extra validation for the data that comes in to our objects.
This is a lightweight post on handling your incoming values effectively by normalizing them as soon as possible. It’s a simple guideline worth keeping in mind which will help you keep your code easier to reason about.
Read more
Over the past few weeks I’ve been migrating our asset pipeline at Spatie from Laravel Elixir (a gulp wrapper) to webpack. Between having endless possibilities, the occasional incomplete section in the docs, and the fact that everyone has slightly different needs for their asset pipeline (which makes examples hard), it has surely been an adventure. I’m going to do a quick summary of my goals, and how I achieved them with webpack. Hopefully there will be some useful snippets in here for when you’re setting up your own webpack configuration.
I’m not going to explain any basic concepts. If you’re new to webpack, I’d recommend you to go through Webpack Your Bags on madewithlove’s blog first. On the other hand, if you just want a tl;dr in the form of a webpack config file, our base configuration is hosted on Github.
Read more
I’m a designer and full-stack developer from Belgium. I work at Spatie, a small but mighty web agency in Antwerp. We specialize in Laravel development, and have released a lot of open source packages.
Over the years, I’ve floated between backend development, frontend development, design, and product/project management.
Colophon
This blog is generated with Hugo and hosted on Netlify. Plain old vanilla CSS and zero JavaScript, except for some privacy friendly analytics with Fathom. Fonts are Karla and Berkeley Mono. I wrote some notes on the most recent design here.
I occasionally send out a newsletter with personal stories, things I’ve been working on in the past month, and interesting things I come across.
There’s no fixed frequency, but generally don’t expect more than one or two mails per month. Consider it an adventure for both of us!