Docker Swarm and Shared Storage Volumes

As we know, volumes provide a flexible and powerful way to add persistent storage to managed dockers, but what should we do if we want to share storage volumes across several Docker hosts, for instance, a Swarm cluster? In this topic, we will consider a simple method of creating shared […]

Setting up XDebug for PHPStorm on Windows & WSL2

In this post, I’m going to go over my short journey to setup my PHP development environment on Windows 10. I will tell you how to setup PHPStorm to debug PHP applications using XDebug and PHP setup over Ubuntu 18.04 LTS on WSL2. I would like to work against the […]

Why is WSL2 so slow?

I’ve been playing around at using WSL2. This is my first time using Window Subsystem for Linux having skipped over WSL1. I typically like to write my software in Node JS, TypeScript and React and I assumed I would be fine jumping into the projects I had previously been working […]

How to open port in CentOS 7/Как открыть порт на CentOS 7

В версии CentOS 7 для управления iptables начали использовать firewalld, он в свою очередь управляется через команду firewall-cmd. В отличии от iptables, firewalld оперирует зонами и сервисами, а не цепочками и правилами. Каждому сетевому интерфейсу присваивается определенная зона, она может быть как пользовательская так и предустановленная. Список предустановленных зон: drop […]

Shorthand comparisons in PHP

You probably already know some comparison operators in PHP. Things like the ternary ?:, the null coalescing ?? and the spaceship <=> operators. But do you really know how they work? Understanding these operators makes you use them more, resulting in a cleaner codebase. Ternary operator The ternary operator is […]

Laravel relationship issues

Or in other words, dealing with complex database relations and Laravel models. Recently I had to deal with a complex performance issue in one of our larger Laravel projects. Let me quickly set the scene. We want an admin user to see an overview of all people in the system […]

How to Mock Final Classes in PHPUnit

Do you prefer composition over inheritance? Yes, that’s great. Why aren’t your classes final then? Oh, you have tests and you mock your classes. But why is that a problem? Since I started using final first I got rid of many problems. Most programmers I meet already know about the benefits of not […]

Switch with instanceof in PHP

There are situations where you need to check what class an object is. The easiest thing is just checking that with instanceof and a simple if statement. But that doesn’t look that good if you’ve got many cases: if($objectToTest instanceOf TreeRequest) { echo «tree request»; } elseif($objectToTest instanceOf GroundRequest) { […]