#laravel #php #localization

Using a database for localization in Laravel

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


#php #programming

Normalize your values on input

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


#webpack #javascript

Adventure Time with Webpack

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


About

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.


Newsletter

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!


Now

Last updated 2023-03-21. What’s this?

Now, I’m learning Svelte. I’m using it for side projects, and recently for a small project at work for the first time.

I’m investing more time in frontend in general & design, after doing primarily backend for the past three years.

In my free time, I’m learning photography.


Speaking

Over the years, I’ve spoken at some conferences and meetups. 2019–2022 was pretty calm on conferences, but I’m looking forward to get back into public speaking in the future.


Uses

Welcome to my /uses page! This isn't meant to be a complete list of everything I touch on a daily basis, but a spotlight of the tools I enjoy using most.

My desk in 2022

Workspace

LaptopMacBook Pro M1 2020
StandRain Design mStand
SpeakersBose Companion 2 Series II speakers
MonitorLG 27MU67
KeyboardKeychron Q1 w/ Phantom Red switches
MouseLogitech MX Master
MicShure MV7
Studio armRode PSA1
HeadphonesAIAIAI TMA-2
DeskFully Jarvis w/ custom rubberwood top
ChairHerman Miller Aeron
LightMr. Wattson

Development

My current IDE of choice is PhpStorm. I’ve been predominantly writing PHP you can’t beat PhpStorm when it comes to navigating and refactoring a large codebase.

Taking autocompletion and other IDE features out of the picture, Sublime Text is still my favorite editor. Its snappiness and multi-cursor options make it feel very natural, and it supports anything you throw at it regardless of format or size. I use a GitHub light theme in both editors.

Productivity

My main browser is Safari. I value its low footprint and sync with my other devices, despite being the weakest of the bunch when it comes to devtools. When I occasionally need more advanced tooling, I switch to Chrome.

I use Things to manage tasks that are time-sensitive or need a reminder. I tend to store more information in note-taking apps. iA Writer has always been a staple for writing and note-taking.

I also want to mention Excalidraw. I do a lot of UX & product design work, and Excalidraw has been my tool of choice to mock up interfaces or create diagrams to clarify specs & documentation.

Reading, learning, leisure

On my Mac & phone I use Reeder. It’s one of those Mac apps that has craft oozing out of it. It’s tied to my Instapaper & Feedbin accounts. I use Feedbin over a free RSS aggregator because it has great email integration for newsletters. Instapaper is my read it later tool of choice because of its Kindle integration, where I do most reading.

I store bookmarks in Pinboard. It’s a fast, simple product that has just the amount of features I need. Another daily driver is Tweetbot which I use on my Mac & phone to browse Twitter.


More setups across the web

Some other people’s setups and uses pages that inspired me in the past or for the future.

Christoph Rumpel
Robin Malfait
Simon Sarris

Freek Van der Herten
Rafael Conde
Stefan Zweifel