TECHMEETUP CONFERENCE · 20 NOV 2026

BUILDING
MODERN APIS
IN PHP

// 2026 edition — our stack, why I love it, and what it cost me

Jan Mikeš
cold open

LET'S BUILD
AN API.
THE 2026 WAY.

cold open

The million-dollar prompt

~/www/myspeedpuzzling.commain
✻ Thinking…
On it: a public puzzle leaderboard endpoint. First I'll read how the existing API v1 endpoints are built.
Read(src/Api/V1, tests/Controller/Api/V1, .claude/rules)
Read 14 files
Search(the website's puzzle leaderboard)
src/Query/GetPuzzleSolvers.php · src/Services/PuzzlesSorter.php
Patterns are clear: DTO + provider, QueryParameter validation, GetPuzzleSolvers + PuzzlesSorter exactly like the website's leaderboard.
Write(src/Api/V1/PuzzleLeaderboardResponse.php)
169 lines
Write(src/Api/V1/PuzzleLeaderboardResponseProvider.php)
160 lines
Write(tests/Controller/Api/V1/PuzzleLeaderboardEndpointTest.php)
394 lines
Bash(phpunit PuzzleLeaderboardEndpointTest)
OK (21 tests, 140 assertions)
21/21 green on the first run.
Bash(phpstan · coding standard)
✓ no errors
Bash(gh pr create --draft)
github.com/MySpeedPuzzling/myspeedpuzzling.com/pull/477
✓ New endpoint GET /api/v1/puzzles/{puzzleId}/leaderboard is ready: 21 tests, validation, filtering, pagination, serialization and OpenAPI documentation.
Sorry, million $ not included.
cold open · animation

It works: pull request #477

GitHub pull request #477, Million-dollar endpoint: puzzle leaderboard, with a description of data, privacy, parameters, errors, auth, docs and 21 tests

IT WORKS. 4 min 5 s · CI green ✓

PR #477 · 21 tests · 830 lines · (Opus 5.5, /effort medium) · github.com/MySpeedPuzzling/myspeedpuzzling.com/pull/477

cold open

THE INTERESTING
PART ISN'T
THE AI.

it's why it only took four minutes.

cold open

EVERYTHING TODAY IS REAL

MYSPEEDPUZZLING.com

the world's largest collection of speed puzzling results and puzzle database

12,500puzzlers
500k+solving times
dailyused every single day
MITopen source

github.com/MySpeedPuzzling/myspeedpuzzling.com

cold open

Speed puzzling is a sport

The World Jigsaw Puzzle Championship hall in Valladolid: rows of competitors solving jigsaw puzzles in front of a big screen

World Jigsaw Puzzle Championship, Valladolid. yes, it's a real sport.

photo: World Jigsaw Puzzle Federation, WJPC 2023 · CC BY-SA 4.0 · via Wikimedia Commons

cold open
The Czech team in yellow shirts in front of the World Jigsaw Puzzle Championship banner in Valladolid, 2026

WJPC 2026 · VALLADOLID

CZECHIA:
WORLD CHAMPIONS
IN TEAMS.

the best team on the planet. from here.

cold open

OUR STACK

PHP 8.5            # yes, still
Symfony 8
API Platform 5     # without Doctrine CRUD
Postgres 18        # 436 hand-written queries
Messenger          # messages, everywhere
FrankenPHP         # worker mode

→ not "best practice". our stack — and why I love it.

cold open

⚠ DISCLAIMER

HIGHLY
OPINIONATED.

who knows me, knows: I'm obsessed with CQS.

reads and writes are different models.

cold open

ACT 1

THE API WAS THE EASY PART

OCT 2023Symfony app. no API.
FEB 2026API Platform. in one day.

→ 2 years 4 months without an API.

act 1 · easy part

HOUR 1 · PLAIN SYMFONY APP → API

$ composer require api

config/routes/api_platform.php

$routes->import('.', 'api_platform')->prefix('/api');

config/packages/api_platform.php · trimmed

'mapping'        => ['paths' => ['%kernel.project_dir%/src/Api']],
'formats'        => ['json' => ['application/json']],
'error_formats'  => ['problem' => ['application/problem+json']],
'name_converter' => 'serializer.name_converter.camel_case_to_snake_case',
'defaults'       => ['stateless' => true],
'oauth'          => ['enabled' => true, 'flow' => 'authorizationCode', …],
act 1 · easy part

VOCABULARY · 3 WORDS FOR THE NEXT 30 MINUTES

RESOURCEa class with #[ApiResource]: URL + operations. any class.
PROVIDERreads. "give me the data for this GET"
PROCESSORwrites. "do something with this input"

→ provider & processor are the touchpoint: request data in → your domain → response out

→ by default both point at Doctrine. that default is the tutorial.

act 1 · easy part

WHAT THEY TEACH
YOU IN SCHOOL

the official docs. the courses. every blog post.

act 1 · school

LESSON 1 · THE ENTITY IS THE RESOURCE

#[ORM\Entity]
#[ApiResource]
class Review
{ … }

→ your table is now your public API. rename a column, break a client.

api-platform.com/docs/symfony · getting started (Book, Review)

act 1 · school

LESSON 2 · SERIALIZATION GROUPS

#[ApiResource(
    normalizationContext: ['groups' => ['read']],
    denormalizationContext: ['groups' => ['write']],
)]
class Book
{
    #[Groups(['read', 'write'])]
    public $name;
}

→ one class, many shapes, chosen by strings spread across many files

api-platform.com/docs/core/serialization · "As soon as any of the author's attributes is in the book group, the author will be embedded."

act 1 · school

LESSON 3 · LOGIC IN A SAVE() DECORATOR

#[ORM\Entity]
#[ApiResource(operations: [
    new Post(
        processor: UserPasswordHasher::class,
        validationContext: ['groups' => ['Default', 'user:create']],
    ),
])]
class User
{
    private ?string $plainPassword = null;  // not a column. lives here anyway.
}

# services.yaml — wraps Doctrine's persist processor
$processor: "@api_platform.doctrine.orm.state.persist_processor"

→ the "register" scenario became a wrapper around save()

api-platform.com/docs/symfony/user

act 1 · school

LESSON 4 · …THE DOCS UN-TEACH THEMSELVES

#[ApiFilter(SearchFilter::class, …)]

→ "The legacy method using the ApiFilter attribute is not recommended."

api-platform.com/docs/core/filters

act 1 · school

WHY IT HURTS IN YEAR 2

SCHEMAis the public contract. refactor a table → version the API
GROUPSwhat goes out depends on strings in 12 files
RELATIONSlazy loading: the N+1 is one serializer call away
LOGIChides in persist hooks and lifecycle events
ONE MODELreads and writes fight over one class

→ tutorials optimise for minute 5. you live in year 5.

act 1 · school

SO WHY DID MINE TAKE ONE DAY?

3 DECISIONS
FROM DAY 1.

the resource · scenarios · the read model

none of them made for an API.

act 1 · easy part

DECISION 1

THE RESOURCE IS
NOT YOUR ENTITY

0 API resources are entities. every single one is a plain DTO.

act 1 · easy part

THE EXAMPLE ENDPOINT · THE RESOURCE

src/Api/V1/PuzzleLeaderboardResponse.php · PR #477

#[ApiResource(operations: [
    new Get(
        uriTemplate: '/v1/puzzles/{puzzleId}/leaderboard',
        provider: PuzzleLeaderboardResponseProvider::class,
        parameters: [ /* filters — act 2 */ ],
    ),
])]
final class PuzzleLeaderboardResponse
{
    public function __construct(
        public string $puzzleId,
        public int $total,
        public bool $hasMore,
        /** @var list<PuzzleLeaderboardEntryResponse> */
        public array $entries,
    ) {}
}

→ one DTO = one response shape. no entity. no groups.

act 1 · easy part

DECISION 2

SCENARIOS,
NOT CRUD

act 1 · easy part

WHAT THE USER ACTUALLY WANTS

CRUD
PATCH /competitions/42
{ "status": "published" }
SCENARIO
POST /competitions/42/publish

→ nobody has ever opened an app to update an entity

act 1 · easy part

DESIGN FROM THE SCREEN, NOT THE TABLE

the screen what the user wants the code
puzzle: Ravensburger 1000 ▾time: 45:12☑ first trySave my time
"add my solving time"
AddPuzzleSolvingTime↓handler

→ name the code after the click, not after the table

→ one command, 4 callers: web form · public API · AI agents · CLI import

act 1 · easy part

WHY NOT CRUD? · "I SOLVED IT!" THE CRUD WAY

# the first try of a puzzle (the client has to move the flag itself)
GET    /puzzle_solving_times?player=me&puzzle=…&first_attempt=true
PATCH  /puzzle_solving_times/{old}    {"first_attempt": false}
POST   /puzzle_solving_times          {"first_attempt": true, "seconds": 2712, …}
DELETE /wish_list_items/{id}          # solved it, so not on my wishlist any more
POST   /notifications …               # to my followers? private profile?
POST   /player_badges …               # for me? my 3 teammates too?
PATCH  /puzzle_statistics/{id} …      # the average time changed

→ 7 calls. 0 transactions. the rules live in the mobile app.

→ crash after call 2? your first try is gone. two phones? two first tries.

act 1 · easy part

"I SOLVED IT!" · THE SCENARIO WAY

POST /api/v1/me/solving-times
{ "puzzle_id": "…", "time": "45:12", "first_attempt": true }
6 RULES · ONE TRANSACTION
same key = same save · no accidental twin · the round must be public · one first try per puzzle (the flag moves) · under 100 pieces/min · teammates resolved
7 REACTIONS · AFTERWARDS
badges for every teammate · XP · puzzle statistics · time predictions · duplicate scan · notify followers (privacy-aware) · off the wishlist

→ 1 call. the rules live where every client has to pass.

src/MessageHandler/AddPuzzleSolvingTimeHandler.php · the PuzzleSolved event, 5 listeners

act 1 · easy part

DECISION 3

THE READ MODEL

ask the database the question the screen asks.

act 1 · easy part

PREDICT

GET /me/results
for our top puzzler

2,327 results · 2,159 puzzles · about 2 MB of JSON

how many SQL queries would classic Doctrine CRUD fire?

?
act 1 · easy part

MEASURED · SAME DB, SAME DATA

Doctrine CRUD   ████████████████████████████  9,210 queries
                9,559 entities in memory · in ONE request
read model      ▏                              7 queries
                0 entities · 108 ms, whole request

→ the REST-purist version: relations as links, the client does the joins. 4,400+ HTTP requests for one screen.

act 1 · easy part

N+1

A person carrying one puzzle piece across a huge warehouse

N+1: walking to the box for every single piece

act 1 · easy part

PUTTING IT TOGETHER · THE LAYERS

HTTP · API Platform application domain · storage
READ
GET→Provider
Query→Result DTO
hand-written SQL
← Response DTO · no entity touched
WRITE
POST→Input ✓→Processor
Command→bus→Handler
Entity→Repository
← handler returns void · the response comes from the read side

→ HTTP lives in the first column only. the rest doesn't know it exists.

act 1 · together

END TO END · READ: RESOURCE → PROVIDER → SQL

src/Api/V1/MyCollectionsResponse.php · MyCollectionsResponseProvider.php · src/Query/GetPlayerCollections.php

#[ApiResource(operations: [new Get(
    uriTemplate: '/v1/me/collections',
    security: "is_granted('ROLE_PAT') or is_granted('ROLE_OAUTH2_COLLECTIONS:READ')",
    provider: MyCollectionsResponseProvider::class,
)])]
final class MyCollectionsResponse { public string $playerId; public int $count; public array $collections; }

// the provider: ask the read side, return the DTO
$collections = $this->getPlayerCollections->byPlayerId($playerId);
return new MyCollectionsResponse($playerId, count(…), array_map(…));

-- the query object: SQL straight into a DTO
SELECT id, name, description, visibility, … FROM collection WHERE player_id = :playerId

→ no entity. no hydration. the website uses the same query.

act 1 · end to end

END TO END · WRITE ① THE INPUT

src/Api/V1/CreateCollectionInput.php

#[ApiResource(operations: [
    new Post(
        uriTemplate: '/v1/me/collections',
        security: "is_granted('ROLE_PAT') or is_granted('ROLE_OAUTH2_COLLECTIONS:WRITE')",
        output: CollectionResponse::class,
        processor: CreateCollectionProcessor::class,
    ),
])]
final class CreateCollectionInput
{
    #[Assert\NotBlank] #[Assert\Length(max: 100)]
    public string $name = '';

    #[Assert\Length(max: 500)]
    public ?string $description = null;
}

→ body validation on the input. invalid? a 422 before any of my code runs.

act 1 · end to end

END TO END · WRITE ② THE PROCESSOR

src/Api/V1/CreateCollectionProcessor.php

$playerId = $user->getPlayer()->id->toString();

if ($profile->activeMembership === false) {
    throw new AccessDeniedHttpException('Active membership is required…');
}

$collectionId = Uuid::uuid7()->toString();

$this->messageBus->dispatch(new CreateCollection(
    collectionId: $collectionId,
    playerId: $playerId,
    name: $data->name, …
));

return new CollectionResponse(collectionId: $collectionId, …);

→ the processor is an adapter. the command has no idea HTTP exists.

act 1 · end to end

END TO END · WRITE ③ COMMAND → HANDLER

src/MessageHandler/CreateCollectionHandler.php

public function __invoke(CreateCollection $message): void
{
    $player = $this->playerRepository->get($message->playerId);

    if ($this->collectionRepository->findByNameAndPlayer(…) !== null) {
        throw new CollectionAlreadyExists(…);
    }

    $this->collectionRepository->save(new Collection(
        id: Uuid::fromString($message->collectionId),
        player: $player, name: $message->name, …
    ));
}

→ the same handler serves the website form, the API and the CLI

→ that was team A: the clean way. five classes for one write.

act 1 · end to end

TEAM B · THE PRAGMATIC WAY

Fantasy Academy · api/src/Message/Subscription/CreateCheckoutSession.php

#[Post(
    uriTemplate: '/subscription/checkout',
    output: CheckoutSessionResponse::class,
    messenger: 'input',
)]
readonly final class CreateCheckoutSession implements UserAware
{
    use WithUserId;

    public function __construct(
        #[Assert\Choice(['monthly', 'yearly'])]
        public string $plan,
        private ?Uuid $userId = null,
    ) {}
}

→ no processor. no mapping. the message is the resource.

→ the handler's return value becomes the response (API Platform reads the HandledStamp)

act 1 · together

WHERE DOES $userId COME FROM?

A · EXPLICIT
$user = $this->security->getUser();
assert($user instanceof ApiUser);
new CreateCollection(
    playerId: $user->getPlayer()…
);
B · MIDDLEWARE
if ($message instanceof UserAware
    && !$envelope->last(ReceivedStamp::class)) {
  $message = $message->withUserId(
    $this->security->getUser()…
  );
}

→ explicit beats magic… until you do it by hand in 426 files

act 1 · together

WHAT DO
YOU THINK?

A: more files, a decoupled contract · B: less code, the command is the contract

hands up: team A … team B …

act 1 · together

MY RULE · OPINION

OWN EVERY CLIENT?
THE MESSAGE CAN BE
THE CONTRACT.

→ strangers integrate with you? put a layer between.

Fantasy Academy: one frontend, same repo → B. MySpeedPuzzling: public API, 4 callers → A.

act 1 · together

ACT 2

PRODUCTION-
GRADE

validation · domain errors · docs · security · speed · and how it bites

act 2 · production

FILTERING + VALIDATION FOR FREE

src/Api/V1/PuzzleLeaderboardResponse.php · PR #477

'type' => new QueryParameter(
    key: 'type',
    constraints: [new Choice(choices: ['solo', 'duo', 'team'])],
),
'country' => new QueryParameter(
    key: 'country',
    castFn: [QueryParameterCaster::class, 'lowercase'],
),
'limit' => new QueryParameter(
    key: 'limit',
    schema: ['type' => 'integer', 'maximum' => 100, 'default' => 20],
    constraints: [new Range(min: 1, max: 100)],
),

→ declared, not coded. and it lands in the OpenAPI docs.

→ ?limit=1000 → 422 problem+json: "limit: This value should be between 1 and 100."

act 2 · production

PAGINATION

src/Api/V1/PuzzleLeaderboardResponseProvider.php · PR #477

$total  = count($rows);
$offset = ($page - 1) * $limit;
$entries = array_slice($rows, $offset, $limit);

// → { "page": 1, "limit": 20, "total": 37, "has_more": true }

→ honest: hand-made. no Doctrine, so no Doctrine paginator.

act 2 · production

BODY VALIDATION · WHEN ATTRIBUTES AREN'T ENOUGH

src/Api/V1/CreateSolvingTimeInput.php

#[Assert\Regex('/^\d{1,2}:\d{2}(:\d{2})?$/', message: 'Time must be in format HH:MM:SS or MM:SS')]
public string $time = '';

#[Assert\Positive]
public ?int $piecesPlaced = null;      // an unfinished competition result

#[Assert\Callback]
public function validateTime(ExecutionContextInterface $context): void
{
    if ($this->piecesPlaced === null && trim($this->time) === '') {
        $context->buildViolation('This value should not be blank.')
            ->atPath('time')->addViolation();
    }
}

→ rules across fields live on the input too. same 422, same violations format.

act 2 · production

THE LIMIT OF VALIDATION

SOME RULES CAN'T
BE CHECKED AT
THE DOOR

"one first try per puzzle" needs the database. and a race beats any form.

act 2 · production

THROWN IN THE DOMAIN

src/MessageHandler/AddPuzzleSolvingTimeHandler.php

if ($message->firstAttempt) {
    $firstTry = $this->firstTryAssessor->assess(…);

    if ($firstTry->blocks($message->firstTryResolution)) {
        throw new FirstTryAlreadyTaken($firstTry);
    }
}

// src/Exceptions/FirstTryAlreadyTaken.php
final class FirstTryAlreadyTaken extends \Exception

→ no HTTP. no status code. just the business saying no.

act 2 · production

TRANSLATED AT THE EDGE

src/Api/V1/CreateSolvingTimeProcessor.php

try {
    $this->messageBus->dispatch(new AddPuzzleSolvingTime(…));
} catch (HandlerFailedException $exception) {
    if ($exception->getPrevious() instanceof FirstTryAlreadyTaken) {
        throw FirstTryConflictResponse::from(…);   // → 422 + a helpful detail
    }
    …
}

// src/Controller/PuzzleAddController.php: the SAME exception
if ($realException instanceof FirstTryAlreadyTaken) {
    $form->addError(new FormError(…));            // → a red form error
}

→ one domain exception. two translations. each door speaks its own language.

act 2 · production

OPENAPI · DOCS THAT CAN'T LIE

src/Api/V1/CreateSolvingTimeInput.php

openapi: new OpenApiOperation(
    description: 'Linking the time to an event (all optional): round_id …',
    parameters: [new Parameter(name: 'Idempotency-Key', in: 'header', …)],
    responses: [
        '422' => new OpenApiResponse(description: 'Invalid input, a first attempt
                  already recorded, or an Idempotency-Key already used…'),
        '404' => new OpenApiResponse(description: 'round_id, competition_id or
                  series_id is unknown… nothing is saved.'),
    ],
),

→ schemas come from the DTOs. the edge cases live next to the code that throws them.

act 2 · production

ONE CODEBASE · 3 KINDS OF CALLER

OAuth2 apps      scopes → roles                        ─┐
personal tokens  Authorization: Token msp_pat_…        ─┼─▶  ApiUser  ─▶  same commands
AI agents        internal API, ~90 scenario endpoints  ─┘

→ who you are is a firewall problem. what you do is a command.

act 2 · production

SECURITY ① WHO ARE YOU?

config/packages/security.php

'api' => [
    'pattern'   => '^/api/v1/',
    'stateless' => true,                           // no session, no cookie
    'oauth2'    => true,                           // league/oauth2-server-bundle
    'custom_authenticators' => [PatAuthenticator::class],
],

'access_control' => [
    ['path' => '^/api/v1/me', 'roles' => [PatUser::ROLE, OAuth2User::ROLE]],
    ['path' => '^/api/v1/players/.*/results', 'roles' => [OAuth2Scope::ResultsRead->role()]],
],

→ scopes become roles. a whole path is closed even if an endpoint forgets.

act 2 · production

SECURITY ② WHAT MAY YOU DO?

// 1. the operation: is this token allowed here at all?
security: "is_granted('ROLE_PAT') or is_granted('ROLE_OAUTH2_COLLECTIONS:WRITE')",

// 2. the processor: the business rule → 403
if ($profile->activeMembership === false) {
    throw new AccessDeniedHttpException('Active membership is required…');
}

// 3. the provider: be nice to the database → 429
if (!$this->apiPuzzleSearchLimiter->create($key)->consume()->isAccepted()) {
    throw new TooManyRequestsHttpException($retryAfterSeconds, …);
}

→ token scope, business permission, rate limit. three questions, three places.

act 2 · production

MIDPOINT BREAK

REMEMBER THE
WORLD CHAMPIONS?

let's talk about how fast they are.

act 2 · easter egg

WORLD RECORD MATH

16:30500 pieces, the fastest solo on MySpeedPuzzling
4:05one endpoint, Claude Code
= 4endpoints per world record
act 2 · easter egg

SPEAKING OF
SPEED.

act 2 · production

"PHP IS SLOW."

— every conference since 2008

act 2 · production

Classic PHP

A puzzler sweeping the whole puzzle back into the box after placing one piece

classic PHP. every. single. request.

act 2 · production

FRANKENPHP

WORKER MODE

boot kernel ─▶ build container ─▶ routing   # once
   ▼
request ─▶ your code ─▶ response ─▶ reset
request ─▶ your code ─▶ response ─▶ reset
request ─▶ …
act 2 · production

PREDICT

GET /api/v1/me

classic   23.6 ms · 167 req/s
worker    ?
act 2 · production

REVEAL · p50 LATENCY

classic   ████████████████████████  23.6 ms
worker    ███                        3.0 ms
14×

167 → 2,368 requests per second

act 2 · production

PRODUCTION · LAST 30 DAYS · ~10M REQUESTS

23 msp50
115 msp95

→ that's worker mode. in production. right now.

act 2 · production

PHP is alive

A cartoon elephant in a hospital bed giving a thumbs up

PHP in 2026: "dead" since 2008. 23 ms p50.

act 2 · production

BUT.

act 2 · war story

NOVEMBER 2025 · A BIG CINEMA CHAIN HERE

"The website logged fans into other people's accounts."

CineStar, the Traitors finale ticket rush · nafilmu.cz, refresher.cz (paraphrased and translated)

→ I laughed. how can that happen to a company that size?

act 2 · war story

31 DEC 2025 · NEW YEAR'S EVE

02:29  commit  "FrankenPHP Worker mode fix"
02:33  deploy  ✗ failed
02:38  deploy  ✗ failed
03:09  deploy  ✗ failed
03:31  Re-run
03:35  deploy  ✓ live        # and I went to sleep
act 2 · war story

Deploy and go to sleep

03:35 · WORKER MODE: ON · GOOD NIGHT

A developer sleeping happily while a server room burns outside the window

what could possibly go wrong?

act 2 · war story

The inbox on New Year's morning

A mail inbox full of urgent bug reports on 1 January

1 JAN 2026 · 50 unread

act 2 · war story

One sign-on for everyone

A crowd of people all wearing the same mask

perfect single sign-on. one sign-on. for everyone.

act 2 · war story

HOW LONG UNTIL IT WAS REALLY FIXED?

~09:00   worker mode off, by hand on the server
1 Jan    15:16  fix #1: reset via reflection on a private property
3 Jan    17:07  fix #2: the real one
3 days 14 h

→ and the upstream fix? reported the same afternoon. still open. day 324.

act 2 · war story

THE LESSON

worker mode doesn't make your code stateful.
it reveals it.

→ reset at the START of every request
→ 52 services implement ResetInterface
→ stateless: true, everywhere
→ the rule lives in CLAUDE.md
act 2 · war story

WHO KEPT
THE USER
IN MEMORY?

a third-party bundle. hold that thought.

act 2 · war story

ACT 3

LIVING
WITH IT

measure · alert · fix in an afternoon

act 3 · living with it

OBSERVABILITY

MEASURE EVERYTHING.
ALERT ON ALMOST NOTHING.

Sentryerrors, traces, profiles, crons, uptime
own statsAPI usage per token: Redis → Postgres
Grafana stackPrometheus, Loki, Tempo
pagingAlertmanager → Telegram
act 3 · living with it

THE ONE PERFORMANCE ALERT

p90(span.duration) > 500 ms   for 30 min
  EXCLUDING
    GET  result_image          # slow by design
    POST stripe_webhook        # Stripe's timing
    GET  sitemap               # bots
    GET  checkout_success      # waits for Stripe

→ every alert must be actionable at 3 a.m.

act 3 · living with it

SEP 2026 · SENTRY WEB-B4

"THE SEARCH
FEELS SLOW."

every header search: 135 ms on average. not broken. just… meh.

act 3 · feels slow

THE TRAP I WALKED INTO

src/Query/SearchPuzzle.php

WHERE name ILIKE :searchFullLikeQuery        -- trigram index ✓ (since January)
   OR identification_number ILIKE :searchFullLikeQuery     -- no index
   OR ean ILIKE :eanSearchFullLikeQuery                     -- no index

→ one OR arm without an index = a full table scan. every search.

act 3 · feels slow

THE FIX · ONE MIGRATION

migrations/Version20260918131133.php · commit 6500b1a88

CREATE INDEX custom_puzzle_identification_number_trgm
    ON puzzle USING GIN (identification_number gin_trgm_ops);
CREATE INDEX custom_puzzle_ean_trgm
    ON puzzle USING GIN (ean gin_trgm_ops);
src/0 lines changed
"wasgij"75 → 12 ms · production
"cat"79 → 8.5 ms · production
act 3 · feels slow

AND THE TEST DIDN'T MOVE

tests/Controller/Api/V1/PuzzleSearchEndpointTest.php · untouched by the fix

$browser->request('GET', '/api/v1/puzzles', ['query' => 'RB-500-001']);

$this->assertResponseIsSuccessful();
$this->assertSame([PuzzleFixture::PUZZLE_500_01], $this->ids(…));

→ the test pins the request and the response. not the implementation.

→ so I can change exactly one thing underneath, and know nothing else moved.

act 3 · feels slow

WHAT TO LOG · AI AGENTS ARE API CLIENTS TOO

$ curl -X POST …/internal-api/series/{seriesId}/publish

[internal_api_audit] Internal API write:
  POST /internal-api/series/…/publish answered 200
  { actingPlayerId, targetIds, createdId }

→ ~90 scenario endpoints, an OpenAPI file, and an audit log

act 3 · living with it

REMEMBER THE EXAMPLE ENDPOINT? · WHY IT TOOK 4 MINUTES

same pattern× many endpoints to copy from
read modelthe query already existed
conventionswritten down in CLAUDE.md
teststhat fail loudly, query budgets included

→ a good architecture for humans is a good prompt for agents

act 3 · living with it

CLOSE

THE DECISION
I'D UNDO

close

WHO KEPT THE USER IN MEMORY?

THE AUTH0
BUNDLE.

I ran my own fork. and my bug report?

auth0/symfony #227  "causes authentication leak in worker mode"
opened     31 Dec 2025, 14:40   # the same afternoon
comments   0
releases   5.7 · 5.8 · 5.9 · 6.0-beta   # none with the fix
status     OPEN · day 324
close

The wet-ink signature

A developer signing a parchment with a quill by candlelight

2026: getting my own users' password hashes back

close

SPREAD
THE WORD.

the few devs I showed this to hated entities as resources. none of them knew a resource can be a plain PHP object.

API Platform is far more powerful than its tutorials.

maybe the most underrated reason to love PHP APIs.

close

THANK YOU

QR code to the MySpeedPuzzling repository
github.com/
MySpeedPuzzling

slides on janmikes.cz

close
Speaker notes — press N to hide

Jump to slide — press O to close

    → / space next step / slide

    ← previous

    N speaker notes

    O jump to slide

    R replay the animation

    T light / dark theme

    F fullscreen

    Home / End first / last slide

    ? close this help