How I host multiple websites on Linode with HAProxy

7.4.2021

This website and a couple others all run on a single small Linode virtual server. Most sites are generated with the static site generator Sculpin, but some require PHP and other technologies.

I wanted to keep the server relatively clean and be able to test my setup locally. Therefore i created a couple of docker containers and use docker-compose to run the whole system. All pages are served over https, using letsencrypt to get free SSL certificates. In this post I want to share about the tools I use.

Read more

php architecture https web server


Integrating rokka.io with the Sculpin Static Site Generator

6.4.2021

Sculpin is a generator for static HTML websites. You write your content in Markdown, Twig Templates or HTML and Sculpin generates the whole page from it. An all-static HTML website is very easy to host, as you only need something to deliver static files like an AWS S3 bucket.

rokka.io is an image CDN that scales and optimizes images for the web. We recently released an update to the Rokka Symfony Bundle that adds support to upload images from Twig templates. As Sculpin is based on Symfony, Bundles can be loaded and configured like with a normal Symfony application.

In this blog post, I will show some examples of how the two can be used to build a static website with images scaled and delivered by rokka.io.

Read more

php architecture rokka web


Symfony World: Decoupling an Application with Symfony Messenger

3.12.2020

Conference: Symfony World 2020, Online
Title: Decoupling an Application with Symfony Messenger

Quick response times are crucial. Time consuming tasks triggered in web requests should be executed asynchronously, if at all possible. In this talk I will give a short overview of what message queues are and then show a case study how we split up an application into smaller services and how we use message queues to coordinate the services.

Read more

php message queues symfony rabbitmq


Doctrine and Generated Columns

26.2.2019

Using a smart SQL query with subqueries, we reduced the time to build a data export by a factor of (at least) 50. On the development system with little data, we got from the response from 11 seconds to about 0.25 seconds.



To make this possible, we had to use a generated column to be able to create an index on a field inside a JSON column. Doctrine does not know Generated Columns, so we had to hide the column and index from the Doctrine Schema Generator.

Read more

php performance mysql doctrine


PSR-18: Abstracting HTTP clients in PHP

26.1.2019
Conference: PHP Benelux 2019, Antwerp, Belgium
Title: PSR-18: Abstracting HTTP clients in PHP
Links: slides, demo

PSR-18 defines how to send PSR-7 requests without binding your code to a specific client implementation. This is particularly interesting for reusable libraries that need to send HTTP requests but don’t care about specific client implementations.

http php


Going crazy with Varnish: Caching pages of logged in users

6.12.2018
Conference: Symfony Con 2018, Lisbon, Portugal
Title: Going crazy with Varnish: Caching pages of logged in users
Links: slides

You know how HTTP caching works but need more? In this talk we look into ways to cache personalized content. We will look at Edge Side Includes (ESI) to tailor caching rules of fragments, and at the user context concept to differentiate caches not by individual user but by permission groups. A big help to leverage this concept is the FOSHttpCache in combination with either Varnish or the Symfony HttpCache reverse proxy.

varnish caching


HTTP Caching with Varnish

22.6.2018
Conference: PHP Romania 2018, Cluj, Romania
Title: HTTP Caching with Varnish
Links: slides

With the Varnish caching proxy you can make websites blazingly fast, while also handling a lot more load. The key is to understand how cache handling in HTTP works. We will also look at concepts like cache invalidation and cache tagging, as well as advanced concepts like Edge Side Includes (ESI). A lot of this talk is applicable regardless of the programming language of your backend. Examples will use the PHP library FOSHttpCache and sometimes the Symfony FOSHttpCacheBundle.

varnish http caching


Beyond REST maturity levels: Insights from building a real life, high-load REST API

29.1.2018
Conference: PHP Benelux 2018, Antwerp, Belgium
Title: Beyond REST maturity levels: Insights from building a real life, high-load REST API
Links: slides

Implementing a REST API is not only about designing correct resource URLs. I will talk about the software and system engineering part it takes to build a data API. I will show concrete examples from a project where we gather data from dozens of different services and systems and build a real-time capable data store. The main technology stack is Symfony, Elasticsearch and Varnish.

rest symfony message queues


Workshop: Debugging PHP Applications

26.1.2018
Conference: PHP Benelux 2018, Antwerp, Belgium
Title: Debugging PHP Applications
Links: joind.in
Format: 3 hours interactive workshop.

Sooner or later, an application will have errors. Some of them will be your fault, or that of a teammate. Others stem from third party libraries you are using. We want to be able to locate the cause of the error as quickly as possible. In this workshop, we will do exercises that will help you debug your applications more efficiently as well as writing them in a way that they get easier to debug.

We will look at the following topics:

- reading stack traces
- how to search through the code base
- writing good exception messages

Read more

workshop php debugging