TYPO3 Helpers 

Extension key

ok_typo3_helper

Package name

oliverkroener/ok-typo3-helper

Version

3.1

Language

en

Author

Oliver Kroener <ok@oliver-kroener.de>

License

This document is published under the Open Publication License.

Rendered

Thu, 16 Jul 2026 07:16:11 +0000


Reusable helper traits, services, and a Microsoft Graph mail converter that other Oliver Kröner TYPO3 extensions build on — including inline-image (cid:) support for mail sent through Microsoft Graph.

Introduction 

Learn what this extension does, its features, and system requirements.

Installation 

Install the extension via Composer and set it up in your TYPO3 project.

Usage 

Convert messages for Microsoft Graph, resolve site roots, and use the reflection accessor trait.

Contact 

Get in touch with the author for support, questions, or contributions.

Introduction 

ok_typo3_helper provides general-purpose functionality and utilities that streamline the development of other TYPO3 extensions. It is used as a shared foundation by the Oliver Kröner extension family — most notably ok_exchange365_mailer, which relies on the Microsoft Graph mail converter shipped here.

Features 

Microsoft Graph mail converter 

MSGraphMailApiService converts a Symfony SentMessage into a Microsoft Graph Message object ready for the Graph sendMail endpoint. It maps:

  • From / To / Cc / Bcc / Reply-To recipients
  • HTML and plain-text message bodies
  • File attachments, including inline images

Inline images (cid:) 

Attachments carrying Content-Disposition: inline are flagged as inline on the Graph FileAttachment and their original MIME Content-ID is carried over. This is essential: Microsoft Graph resolves an <img src="cid:xxx"> in the HTML body by matching xxx against the attachment's contentId. Without the Content-ID, the image bytes still arrive but the body reference cannot bind, so the image renders broken.

The value is read via getContentId(), which already returns the identifier without the surrounding <> — so it matches the cid: reference in the body verbatim, with no manual trimming.

Site root resolver 

SiteRootService is a singleton service that returns the site root page UID for any given page UID, resolving a SiteNotFoundException to null.

Reflection accessor trait 

ReflectionPropertiesTrait adds dynamic getXxx() / setXxx() access to any class's properties — including protected and private ones — via __call() and reflection.

Requirements 

  • TYPO3 12.4 LTS, 13.4 LTS, or 14 LTS
  • PHP 8.1 or newer
  • microsoft/microsoft-graph ^2 (installed automatically)
  • zbateson/mail-mime-parser ^3 (installed automatically)

Installation 

Composer 

Install the extension via Composer:

composer require oliverkroener/ok-typo3-helper
Copied!

Local path repository 

When used as a local path-repository extension (as in the oliverkroener project layout), place the package under packages/ and require it as a development version:

composer require oliverkroener/ok-typo3-helper:@dev
Copied!

Setup 

After installation, run the extension setup and flush caches:

vendor/bin/typo3 extension:setup
vendor/bin/typo3 cache:flush
Copied!

The Microsoft Graph SDK (microsoft/microsoft-graph) and the MIME parser (zbateson/mail-mime-parser) are declared as dependencies and are installed automatically.

Usage 

Converting a message for Microsoft Graph 

MSGraphMailApiService::convertToGraphMessage() is static and takes a Symfony SentMessage. It returns an array with the built Graph message and the resolved from address:

use OliverKroener\Helpers\MSGraphApi\MSGraphMailApiService;

$result = MSGraphMailApiService::convertToGraphMessage($sentMessage);
$graphMessage = $result['message']; // Microsoft\Graph\Generated\Models\Message
$fromAddress  = $result['from'];    // string|null
Copied!

Inline images work automatically: build the mail with Symfony's ->embed() (or a TYPO3 Fluid mail template with an inline image), and the cid: reference in the HTML body is preserved end-to-end into the Graph attachment's contentId. This is what lets Outlook / OWA render the image inside the body instead of only listing it as an attachment.

Resolving the site root 

SiteRootService returns the site root page UID for a given page UID. It is registered as a public singleton in Configuration/Services.yaml and can be injected via dependency injection:

use OliverKroener\Helpers\Service\SiteRootService;

$rootPageId = $siteRootService->findNextSiteRoot($currentPageId); // int|null
Copied!

If the page is not part of any configured site, null is returned.

Dynamic property accessors 

ReflectionPropertiesTrait provides dynamic getters and setters via __call() and reflection, giving access to protected and private properties:

use OliverKroener\Helpers\Traits\ReflectionPropertiesTrait;

class MyModel
{
    use ReflectionPropertiesTrait;

    private string $title = '';
}

$model = new MyModel();
$model->setTitle('Hello');   // routed through __call → reflection
echo $model->getTitle();     // "Hello"
Copied!

An unknown method name, or access to a property that does not exist, throws an \Exception.

Contact 

Author — Oliver Kroener 

Automated. Scaled. Done. 

Web3 · Cloud · Automation

Technology is only valuable when it solves a real problem. For over 30 years I've been translating between business and tech — so your investment in digitalisation doesn't stall at proof-of-concept but delivers measurable results.

Support 

If you encounter issues or have questions about this extension:

Contributing 

Contributions are welcome. Please open a pull request or issue on GitHub.

License 

This extension is licensed under the GPL-2.0-or-later.