Reference: Interfaces
Public interfaces in the `FriendsOfTYPO3Headless` namespace. Inject these rather than the concrete classes — it keeps your code testable and DI-friendly.
| Interface | What it gives you |
|---|---|
Utility | Detect / switch headless mode for a request. Methods:
is, is,
with,
override. |
Utility | URL rewriting from backend to frontend. Methods:
with, with,
get, get,
get, get,
get, resolve,
prepare.
(with exists only on the concrete
Url.) |
Utility | File / image rendering. Methods: set,
process, process, process,
process, get,
get. process returns the same shape that
ships in content.*. by default. |
Json | encode. Wraps json_ with
HTML-safe flags and the headless. feature
flag. Does not throw on invalid data: encoding
errors are caught, logged as critical, and " is
returned. |
Json | decode recursively unwraps JSON strings nested
inside arrays. is detects JSON by fully
decoding the value after cheap pre-checks. |
Seo | process — runs the SEO meta-tag
pipeline (page title, meta registry, hreflang) and
merges it under content.. |
Data | Strategy for Root to discover sites. |
Data | Strategy for shaping the JSON each site produces. |
Data | Strategy for sorting sites in the output. |
Form | Dynamic options for a form select/radio/checkbox. See EXT:form. |
Form | Custom JSON shape for an EXT:form definition. |
DI wiring
File, Headless,
Json, Json and
Meta are aliased in the extension's Services.;
Headless via # on Headless. Plain
constructor injection works for those:
final readonly class MyService
{
public function __construct(
private HeadlessModeInterface $headlessMode,
private HeadlessFrontendUrlInterface $urlUtility,
private JsonEncoderInterface $jsonEncoder,
) {}
}
The remaining interfaces (Root,
Form, Definition) are
contracts you implement and hand to the extension via TypoScript or
form YAML — they carry no container alias.
Url and Headless are shared services; state safety comes
from their wither methods (with / with return
clones), not from share: false.