TYPO3 Helpers 

Extension key

ok_typo3_helper

Package name

oliverkroener/ok-typo3-helper

Version

2.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:20 +0000


A TYPO3 extension providing reusable helper services, traits and utilities to streamline the development of other TYPO3 extensions — including a Microsoft Graph mailer service, a site root resolver and reflection-based property accessors.

Introduction 

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

Installation 

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

Configuration 

Understand how the helper services are registered and wired up.

Usage 

See how to use the mailer service, site root resolver and trait in code.

Contact 

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

Introduction 

ok_typo3_helper is a TYPO3 extension developed by Oliver Kroener that provides general-purpose services, traits and utilities to streamline the development of other TYPO3 extensions.

Features 

Microsoft Graph mailer service 

MSGraphMailApiService converts a Symfony Mailer SentMessage into a Microsoft Graph-compatible Message object, ready to be sent through the Microsoft Graph API. It transfers:

  • From, To, Cc, Bcc and Reply-To recipients, including both address and display name
  • the HTML or plain-text body, auto-detected from the parsed MIME message
  • attachments, including inline images with their original Content-ID so that cid: references in the HTML body keep rendering correctly

Site root service 

SiteRootService is a singleton that resolves the root page UID for a given page ID using TYPO3's SiteFinder. It returns null when no site is configured for the given page.

Reflection properties trait 

ReflectionPropertiesTrait adds magic getXxx() / setXxx() accessors that read and write protected or private properties through reflection.

Requirements 

  • TYPO3 11.5 LTS
  • PHP 7.4 or higher
  • microsoft/microsoft-graph ^2 (installed automatically)
  • zbateson/mail-mime-parser ^2 (installed automatically)

Installation 

Composer 

Install the extension via Composer:

composer require oliverkroener/ok-typo3-helper
Copied!

The required dependencies microsoft/microsoft-graph and zbateson/mail-mime-parser are installed automatically.

Local development 

To use a local checkout during development, add a path repository to your project's composer.json:

{
    "repositories": [
        { "type": "path", "path": "packages/ok_typo3_helper" }
    ]
}
Copied!

Then require the package and activate the extension:

composer require oliverkroener/ok-typo3-helper
vendor/bin/typo3 extension:activate ok_typo3_helper
Copied!

Configuration 

This extension does not ship any extension-manager settings. Its services are registered through dependency injection in Configuration/Services.yaml.

Service registration 

All classes under Classes/ are autowired and autoconfigured. The SiteRootService is additionally registered as a public singleton so it can be fetched directly from the container or via GeneralUtility::makeInstance():

services:
  _defaults:
    autowire: true
    autoconfigure: true
    public: false

  OliverKroener\Helpers\:
    resource: '../Classes/*'

  OliverKroener\Helpers\Service\SiteRootService:
    public: true
    autowire: true
    autoconfigure: true
    tags: ['singleton']
Copied!

Microsoft Graph credentials 

MSGraphMailApiService only converts a message into the Graph Message format — it does not authenticate against Microsoft Graph itself. Authentication and the actual sending are the responsibility of the calling code, which must provide a configured Microsoft Graph client (for example an OAuth2 client-credentials flow with tenant ID, client ID and client secret).

Usage 

Sending mail through Microsoft Graph 

Convert an outgoing Symfony SentMessage into a Microsoft Graph message and hand it to the Graph API:

use OliverKroener\Helpers\MSGraphApi\MSGraphMailApiService;

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

The returned Message already contains recipients, subject, body and attachments (including inline images) and can be posted to the /users/{id}/sendMail endpoint with a configured Graph client.

Resolving the site root of a page 

SiteRootService is a public singleton and can be injected or fetched from the container:

use OliverKroener\Helpers\Service\SiteRootService;
use TYPO3\CMS\Core\Utility\GeneralUtility;

$rootPageId = GeneralUtility::makeInstance(SiteRootService::class)
    ->findNextSiteRoot($currentPageId); // int|null
Copied!

Reflection-based accessors 

Add magic getters and setters to any class:

use OliverKroener\Helpers\Traits\ReflectionPropertiesTrait;

class Example
{
    use ReflectionPropertiesTrait;

    protected string $name = '';
}

$example = new Example();
$example->setName('TYPO3');   // writes the protected property
echo $example->getName();     // reads it back
Copied!

Calling a getter or setter for 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.