RSSAmplifier

Blog

Supun's Blog

supun.ioRSS feed ↗25 posts

Latest posts

With --time-limit, does Symfony kill messenger consumers while a message is being handled?

I was worried about that, and it appears Symfony does not kill messenger consumers while a message is being handled, only after the message is handled . This is true for all --limit , --memory-limit , --time-limit options. Let’s look at the code of the messenger:consume command ( source ): 1 // when --limit 2 $this-> eventDispatcher -> addSubscriber ( new StopWorkerOnMessageLimitListener ( $ limit…

Testing Mago as an alternative to PHPStan

I discovered Mago , a PHP toolchain written in Rust, on Reddit a couple of days back. It recently published version 1.0. I am testing it primarily as a candidate to replace PHPStan. PHPStan has been incredible in terms of the features it provide. But, it’s slow. Having experienced a near-instant DX with typescript, PHPStan's speed has always been a problem. In Hyvor Relay repo, which has about…

Reading Books Probably Changed My Brain

Until last year, I rarely read any books beyond textbooks. I had never been a good reader. Whenever I started reading a book, I would try to recall what I had read in the previous chapters, but I remembered almost nothing. So, I would start over. This cycle continued, and I never managed to finish a single book. Then, in March of this year, I found myself in a small town called…

Renewing French Tech Visa for Founders

My experience renewing French Tech Visa for Founders

On Sophie's World

A short review of Sophie's World.

Symfony: Using the Database for Cache

My requirements: Use the database for all caching in the app Cache should reuse the connection I already have in the Symfony app via Doctrine It took longer than I expected to figure that out. Symfony’s Cache documentation was confusing to me. Adapters? Providers? Direct Solution If you don’t have much time, here’s what you need to do: config/packages/config.yaml 1 framework : 2 cache : 3 app :…

Read RFCs

Read RFCs

Sending Laravel Queued Job Errors to Sentry

I noticed today that some billing-related jobs in HYVOR production failed, but these were not reported to Sentry, which was extremely concerning (thankfully, they were logged in the failed_jobs table). Turns out, due to how Laravel handles queues, exceptions are not thrown outside of the job. Sentry recommends manually reporting them to Sentry in the job’s failed method. However, I am not going to…

On Hawking's Brief History of Time

A review of Stephen Hawking's "A Brief History of Time"

Symfony: Using Project Root in Services

How to use Project Root variable in Symfony

Restrict external SSH access using Tailscale and UFW in Ubuntu

Restricting SSH connections only to Tailscale-authenticated users on Ubuntu using UFW.

Fixing /var/lib/docker/containers too large issue

Today, some staging deployments failed and I found out one of the servers has run out of disk space, where /var/lib/docker/containers had grown unexpectedly large because of large log files. Finding the largest folders: 1 # start with / 2 sudo du -h -x --max-depth=1 / | sort -hr 3 4 # then go into largest one one by one 5 sudo du -h -x --max-depth=1 /var | sort -hr 6 sudo du -h -x --max-depth=1…

Iced.rs didn't work out (a web dev's experience)

Well, I’ve been learning Rust. Being a web dev, Rust is exciting territory. After working on some toy projects, I decided it was time to contribute to some open-source projects. Building GUIs with Rust always fascinated me so I kept looking for projects to work on. The first exciting project I found was Sniffnet , a GUI app to monitor internet traffic. I went through the codebase. It uses Iced.rs…

Ad-blocking with Headless Raspberry Pi and Pi-hole

A few months ago, I suddenly thought it was cool to buy a Raspberry Pi. Indeed, it was cool! Raspberry Pi 4 I then set up a headless (no monitor, no keyboard) Raspberry Pi with Pihole installed for network-level ad blocking . Pihole does this by working as a DNS resolver that blocks (well, technically, resolves into an invalid IP address) known tracker/ad domains. So, I won’t need an extension on…

How to set up Caddy Fallback for Sveltekit Static Adapter

How to set up Caddy Fallback for Sveltekit Static Adapter

How to set up redirects with Sveltekit Static Adapter

We are setting up redirects with the static adapter in Sveltekit.

How to change env dir to the parent folder in Laravel and Vite

A simply tip on how to set env dir to the parent folder in Laravel and Vite.

How to redirect trailing slash to non-trailing slash URL in Cloudflare?

Learn how to redirect a URL with a trailing slash to its non-trailing slash version using Cloudflare Redirect Rules.

How to use a custom morph class in Laravel?

Laravel polymorphism is a quite elegant solution. Yesterday, I came up with a problem with the *able_type column value when using extended versions of the model. The Problem Most our code at HYVOR has something called access objects: 1 // Project.php 2 class Project extends Model 3 {} 4 5 // AccessProject.php 6 class AccessProject extends Project 7 {} It simply extends a Laravel model. Then, in…

PHP-fpm performance tuning for high traffic servers

Use pm = static for high traffic servers.

Javascript: How to count words in a multi-language safe way?

See how to count words in Javascript in a multi-language safe way.

Designing a score meter with React, SVG, and CSS.

Let's build a score meter using React, SVG, and CSS.

Easy Zero-downtime Docker Compose deployment

How to deploy your application with zero downtime using Docker Compose.

An inefficient way to wait for Meilisearch to complete all async tasks

I have been working on integrating Meilisearch into Hyvor Talk as a secondary database to make comments search faster. Meilisearch is a fine solution for our use case, however, when it comes to automated testing, Meilisearch’s asynchronous document handling poses a problem. Our search endpoint tests look like this (we use PHP and Laravel): 1 it ( ' searches for comments ' , function () { 2 // seed…

How to export large datasets into a JSON file in PHP without memory exhaustion

This article is about how I came up with a solution to export large datasets into a JSON file in PHP. If you just need a solution, use the php-json-exporter library. Computers have become cheaper, but RAM capacity is still expensive. In a usual cloud provider, an 8GB VPS costs around 20-40$/month. 8GB is sufficient for most tasks. For example, a simple PHP request takes about 3MB-10MB when…