PHP code example of oliverkroener / ok-typo3-helper

1. Go to this page and download the library: Download oliverkroener/ok-typo3-helper library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

oliverkroener / ok-typo3-helper example snippets


use OliverKroener\Helpers\MSGraphApi\MSGraphMailApiService;

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

use OliverKroener\Helpers\Service\SiteRootService;

// Injected via DI (registered public in Configuration/Services.yaml)
$rootPageId = $siteRootService->findNextSiteRoot($currentPageId); // int|null

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"

ok_typo3_helper/
├── Classes/
│   ├── MSGraphApi/
│   │   └── MSGraphMailApiService.php
│   ├── Service/
│   │   └── SiteRootService.php
│   └── Traits/
│       └── ReflectionPropertiesTrait.php
├── Configuration/
│   └── Services.yaml
├── Resources/
│   └── Public/Icons/Extension.png
├── ext_emconf.php
├── ext_localconf.php
└── composer.json