Readability is relative

| 4 min read

When I write a library that’s going to be used by others, I strive for a gentle learning curve. When someone reads code that uses my library, I want them to understand what’s happening without reading a bunch of documentation first. I tend to keep my API’s as explicit as possible, and try to stay away from odd or foreign notations.

My colleague Brent is writing a library to deal with date & time periods in PHP. There was a discussion whether a period’s boundaries should be included in the range or not.

Read more


Highlighting code blocks with league/commonmark

| 1 min read

Since the first iteration of my blog—some time around 2016—I’ve used highlight.js to highlight code blocks. With highlight.js being so popular, I never really second guessed the idea. It was a given to use JavaScript.

A few weeks ago, TJ Miller introduced me to highlight.php by writing a Parsedown extension for it. Highlight.php does the exact same thing as highlight.js: they both add tags and classes to your code blocks, which enables them to be highlighted with CSS. The difference is, highlight.php does this on the server.

Read more


Mo' models mo' problems

| 3 min read

One of the best things about Vue templates is the special v-model prop. v-model allows you two quickly map prop getters and setters without breaking unidirectional data flow. Props down, events up.

Read more


Distraction-less user interfaces: Delayed transient states

| 5 min read

This is the first post in a series about removing distractions from an interface to provide a better user experience.

I have a specific pet peeve with user interfaces: things that draw my attention when they don’t need to. In any graphical interface, movement is distraction. Our eyes are naturally drawn to anything in motion.

Motion is a powerful tool. We can abuse this distraction to attract our users to a certain place: a notification, an added list item after a background refresh, etc. Let’s look into the movement behind a form submission. Below are three dummy forms, each with a different server response time.

Read more


Vue templates in JSX

| 6 min read

In my most recent project at work, I’m experimenting with JSX templates in Vue. Vue offers first-party support for JSX with near-zero configuration, but it doesn’t seem to be commonly used in the ecosystem.

Read more


A good issue

| 1 min read

Maintaining a number of open source projects comes with a number of issues. Reporting a good issue will result in a more engaged approach from project maintainers. Don’t forget: there’s a human behind every project.

Read more


Code splitting with Laravel Mix

| 5 min read

Code splitting is bundler feature—if you’re using Laravel Mix, you’re bundling your assets with Webpack—that allows you to split application scripts in multiple files. These can then conditionally be loaded at a later stage.

Read more


Server side rendering JavaScript from PHP

| 10 min read

Server side rendering is a hot topic when it comes to client side applications. Unfortunately, it’s not an easy thing to do, especially if you’re not building things in a Node.js environment.

I published two libraries to enable server side rendering JavaScript from PHP: spatie/server-side-rendering and spatie/laravel-server-side-rendering for Laravel apps.

Let’s review some server side rendering concepts, benefits and tradeoffs, and build a server renderer in PHP from first principles.

Read more


A pair of helping hands when naming things

| 1 min read

One of the hardest (and sometimes frustrating) tasks in a programmer’s day-to-day workload is naming things. When I have a hard time finding that perfect word, I generally wind up in one of two situations:

  • I have a plausible name in mind, but I’m not entirely satisfied with it
  • I have no idea what I could possibly name it

Luckily, there are tools out there that can be of help.

Read more


Blade component aliases in Laravel 5.6

| 2 min read

Laravel 5.6 adds the ability to register alias directives for Blade components. Let’s review some background information and examples.

Read more