---
title: "Feature: #106405 - TypolinkBuilderInterface"
manual: "TYPO3 Core Changelog"
version: "main"
permalink: "https://docs.typo3.org/permalink/changelog:feature-106405-1742674556"
source: "Changelog/14.0/Feature-106405-TypolinkBuilderInterface.rst"
typo3-version: "14.0"
typo3-major: 14
type: "feature"
issue: 106405
forge: "https://forge.typo3.org/issues/106405"
tags: ["PHP-API", "ext:frontend"]
rendered: "2026-09-28T19:48:07+00:00"
---

# Feature: #106405 - TypolinkBuilderInterface {#feature-106405-1742674556}

See [forge#106405](https://forge.typo3.org/issues/106405)

## Description {#description}

A new interface `\TYPO3\CMS\Frontend\Typolink\TypolinkBuilderInterface`
has been introduced to provide a more flexible way to generate links in TYPO3.

The interface defines a `buildLink()` method that replaces the previous
`build()` method approach used when extending from
`\TYPO3\CMS\Frontend\Typolink\AbstractTypolinkBuilder`.

All Core `TypolinkBuilder` implementations now implement this interface and
use dependency injection for improved service composition and testability.

The interface method signature is as follows:

```php
use TYPO3\CMS\Frontend\Typolink;

public function buildLink(
    array $linkDetails,
    array $configuration,
    ServerRequestInterface $request,
    string $linkText = ''
): LinkResultInterface;
```

## Impact {#impact}

-   All implementations of
    `\TYPO3\CMS\Frontend\Typolink\TypolinkBuilderInterface` are
    automatically configured as public services in the dependency injection
    container, removing the need for manual service configuration.
-   `TypolinkBuilder` classes can now use proper dependency injection through
    their constructors, improving testability and aligning with TYPO3's
    architectural best practices.
-   The `\Psr\Http\Message\ServerRequestInterface` is now passed
    directly, providing access to the request context without relying on global
    state.
-   The new interface introduces a cleaner separation of concerns
    and more explicit parameter passing.

## Example usage {#example-usage}

Creating a custom `TypolinkBuilder` using the new interface:

**EXT:my_extension/Classes/Typolink/MyCustomLinkBuilder.php**

```php
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Frontend\Typolink\LinkResult;
use TYPO3\CMS\Frontend\Typolink\LinkResultInterface;
use TYPO3\CMS\Frontend\Typolink\TypolinkBuilderInterface;

final readonly class MyCustomLinkBuilder implements TypolinkBuilderInterface
{
    public function __construct(
        private MyCustomService $customService,
        private AnotherService $anotherService,
    ) {}

    public function buildLink(
        array $linkDetails,
        array $configuration,
        ServerRequestInterface $request,
        string $linkText = ''
    ): LinkResultInterface {
        // Access ContentObjectRenderer from the request
        $contentObjectRenderer = $request->getAttribute('currentContentObject');

        // Use injected services
        $processedData = $this->customService->process($linkDetails);

        // Build and return link result
        return new LinkResult($processedData['url'], $linkText);
    }
}
```

Registering the TypolinkBuilder class is still necessary via
`$GLOBALS['TYPO3_CONF_VARS']`.
