Reference: Interfaces
Public interfaces of EXT:. Inject these rather than the concrete
classes.
Services
\FriendsOf TYPO3\ Headless\ Utility\ Headless Mode Interface - Detect / switch headless mode for a request. Methods:
is,Enabled () is,Enabled For ($request) with,Request ($request) override.Backend Request By Site ($site, $language) \FriendsOf TYPO3\ Headless\ Utility\ Headless Frontend Url Interface - URL rewriting from backend to frontend. Methods:
with,Site () with,Request () get,Frontend Url () get,Frontend Url With Site () get,Frontend Url For Page () get,Proxy Url () get,Storage Proxy Url () get,Storage Proxy Url For Storage () resolve,Key () prepare. (Relative Url If Possible () withexists only on the concreteLanguage () Url.)Utility \FriendsOf TYPO3\ Headless\ Utility\ File Utility Interface - File / image rendering. Methods:
set,Request () process,File () process,() process,Image File () process,Crop Variants () get,Absolute Url () get.Errors () processreturns the same shape that ships in() content.*.by default.media \FriendsOf TYPO3\ Headless\ Json\ Json Encoder Interface encode. Wraps($data, $options = 0) json_withencode JSON_(not HTML-safe) and the headless.prettyPrint flag. Does not throw on invalid data: encoding errors are caught, logged as critical, andHEX_ APOS | JSON_ HEX_ AMP "is returned.[]" \FriendsOf TYPO3\ Headless\ Json\ Json Decoder Interface decoderecursively unwraps JSON strings nested inside arrays.(array) isdetects JSON by fully decoding the value after cheap pre-checks.Json ($mixed) \FriendsOf TYPO3\ Headless\ Seo\ Meta Handler Interface process— runs the SEO meta-tag pipeline (page title, meta registry, hreflang) and merges it under($request, $content) content..seo
Contracts you implement
\FriendsOf TYPO3\ Headless\ Data Processing\ Root Site Processing\ Site Provider Interface - Site discovery for
Root(Sites Processor site). Methods:Provider prepare,(array $config, int $site Uid): self get,Sites (): array get,Pages (): array get.Current Root Page (): Site \FriendsOf TYPO3\ Headless\ Data Processing\ Root Site Processing\ Site Schema Interface - Shapes the JSON produced per site (
site). Method:Schema process.(Site Provider Interface $provider, array $options = []): array \FriendsOf TYPO3\ Headless\ Data Processing\ Root Site Processing\ Site Sorting Interface - Site order (
sorting, used by the defaultImplementation Site). Method:Provider sort; instantiated with(): array ($sites, $pages, $sorting.Field) \FriendsOf TYPO3\ Headless\ Form\ Custom Options Interface - Dynamic options for a form select/radio/checkbox. Method:
get. See EXT:form.(): array \FriendsOf TYPO3\ Headless\ Form\ Decorator\ Definition Decorator Interface - Custom JSON shape for an EXT:form definition. Method:
__. See Customising the JSON output (decorators).invoke (array $definition, int $current Page): array
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:
use FriendsOfTYPO3\Headless\Json\JsonEncoderInterface;
use FriendsOfTYPO3\Headless\Utility\HeadlessFrontendUrlInterface;
use FriendsOfTYPO3\Headless\Utility\HeadlessModeInterface;
final readonly class MyService
{
public function __construct(
private HeadlessModeInterface $headlessMode,
private HeadlessFrontendUrlInterface $urlUtility,
private JsonEncoderInterface $jsonEncoder,
) {}
}
The contracts carry no container alias: you hand the class name to the
extension via TypoScript (Root) or form YAML, and it is
instantiated with General.
Url and Headless are shared services; state safety comes
from their wither methods (with / with return
clones), not from shared: false.