Skip to content

Instantly share code, notes, and snippets.

View phenaproxima's full-sized avatar

Adam phenaproxima

View GitHub Profile
@phenaproxima
phenaproxima / project-browser-api.md
Last active August 3, 2025 14:13
Project Browser and its API

Let's learn a little bit about how Project Browser works.

You can trust me. Together with @chrisfromredfin, @tim.plunkett, and a lot of other contributors, I have spent the better part of the last year refactoring, rearchitecting, and rewriting most of Project Browser, to try and lift it out of its proof-of-concept roots and turn it into a modernized extension browsing and installation system for Drupal. This, then, is a tour of Project Browser from a developer's perspective.

The thing you need to know about Project Browser is that, despite being a decoupled app, it has no JavaScript API at all. The UI, which is written in Svelte, is completely and totally locked down and cannot be extended. What API surface it has is entirely on the PHP side. So let's talk about what those parts are.

The Project class

The most important class in Project Browser is Project. It is a value object that represents a single project that you can see in the UI. Project Browser takes a pretty expansive definition of what

@phenaproxima
phenaproxima / xb-internals.md
Last active April 27, 2025 14:41
phenaproxima's human-grokable notes about XB internals

My First Week With Experience Builder

I’m an experienced backend software engineer and Drupal core developer and until a few days ago, I knew basically nothing about Experience Builder (“XB” to the cool kids) except that it’s really neat, and was all the rage at DrupalCon Atlanta. Its internals were a mystery to me, and for the most part, they still are.

But I’ve been partially assigned to actually work on XB this quarter, so I had to dive in and try to learn how it works. Deep breath...

First, I tried reading its documentation: no luck there. The docs are rich in detail, but they're also extremely pedantic, which makes for a soul-sucking read, and they don't explain the big picture that's needed for all those fiddly details to make sense.

XB is also a fast-moving target with an unbelievable amount of complexity. For my money, this is probably one of the most complicated Drupal modules in existence; it’s gotta be right up there with Views.

@phenaproxima
phenaproxima / apply-a-recipe.php
Last active February 12, 2025 17:04
How to programmatically apply a Drupal recipe (works in 10.3 and later)
<?php
use Drupal\Core\Batch\BatchBuilder;
use Drupal\Core\Recipe\Recipe;
use Drupal\Core\Recipe\RecipeRunner;
// There are two ways to apply a recipe programmatically: immediately, or as a batch job.
// The batch job is generally the safer option, since more complex recipes could risk
// timing out if they try to do too much at once.
@phenaproxima
phenaproxima / DarmokIpsum.js
Created February 3, 2019 05:01
A Tamarian ipsum generator. Temba, his arms wide!
//
// This ipsum generator is adapted from code at
// https://hackernoon.com/creating-a-lorem-ipsum-generator-with-node-and-express-9e1af0b31c86
//
// Tamarian phrases from http://memory-alpha.wikia.com/wiki/Tamarian_language
//
class DarmokIpsum
{
constructor ()
{