Terence Eden. He has a beard and is smiling.

Terence Eden’s Blog

Theme Switcher:

A (tiny, incomplete, single user, write-only) ActivityPub server in PHP

· 10 comments · 900 words · Viewed ~1,067 times


Screenshot of a map. There is a pop-up containing an image of me drinking a pint.

I've written an ActivityPub server which only allows you to post messages to your followers. That's all it does. It won't record favourites or reposts. There's no support for following other accounts or receiving replies. It cannot delete or update posts nor can it verify signatures. It doesn't have a database or any storage beyond flat files. But it will happily send messages and allow…

Rewriting OpenBenches in Symfony

· 2 comments · 350 words


The Open Benches logo.

I once described my ideal coding environment to a colleague as "telneting directly into prod and damn the consequences!" I jest. But only a little. When I build for myself I treat best practices and coding styles as harmful. Chaotic evil but, hey, it's only myself I'm hurting. Anyway, my wife and I run a hobby site - OpenBenches.org - which was coded in a long alcopop fueled weekend. It's fair…

Getting Auth0 user information on non-firewall Symfony pages

· 250 words


Logo of the Symfony project.

I am using Auth0's Symfony library to allow users to log in with their social network providers. It works really well. Using this firewall configuration, a user who visits /private is successfully taken through the login flow and I can then use $this->getUser() to see their details. security: password_hashers: Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: …

Doctrine - difference between bindValue() and setParameter() on prepared statements

· 1 comment · 400 words · Viewed ~1,110 times


Doctrine project logo.

This pissed me off and I couldn't figure out what I was doing wrong. So I'm blogging about my ignorance. Imagine you're using Symfony and Doctrine to access a database. You are using prepared statements to prevent any SQL injection problems. There are two main ways of doing this - and they disagree about how positional variables should be specified. Data Retrieval And Manipulation Here's a…

Symfony - multiple paths to the same route within a controller

· 1 comment · 100 words · Viewed ~1,801 times


Logo of the Symfony project.

I couldn't work out how to use Route Aliasing within my controller. I couldn't find anything in the documentation about it. But, thanks to a StackOverflow comment it is possible. Suppose you want users to be able to access a page using /users/123 and /people/123 - with both routes displaying the same data? Normally you'd write something like #[Route('/user/{id}', name: 'show_user')] - as it…

Fixing a weird issue with Symfony's Cache

· 150 words


Logo of the Symfony project.

I'm just getting started with Symfony, so I'm blogging some of the weird things I'm finding. Symfony has a concept of Cache Contracts. You can call an expensive / slow / intensive operation and immediately cache the result for a specific time period. Next time you call the operation, the results are served from the cache until the expiry time has been hit. Nifty! But I couldn't get it to work. …

Doctrine - how to use LIKE with dbal prepared statements

· 1 comment · 150 words · Viewed ~370 times


Logo of the Symfony project.

I'm just getting started with Symfony, so I'm blogging some of the weird things I'm finding. I want to use Doctrine dbal to search a database for a partial match. For example searching for "smith" should find "blacksmith" and "smithy". I have a prepared statement like this: $queryBuilder = $conn->createQueryBuilder(); $queryBuilder ->select("whatever") ->from("table") ->where("name …