PHP code example of viewmend / typo3-core

1. Go to this page and download the library: Download viewmend/typo3-core 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/ */

    

viewmend / typo3-core example snippets




declare(strict_types=1);

namespace Vendor\Product\Integration\ViewMend;

use ViewMend\Typo3Core\Contract\ProductProviderInterface;
use ViewMend\Typo3Core\Product\ProductDefinition;

final readonly class ProductProvider implements ProductProviderInterface
{
    public function product(): ProductDefinition
    {
        return new ProductDefinition(
            identifier: 'example-product',
            title: 'Example product',
            description: 'A concise description of the product outcome.',
            composerPackage: 'vendor/typo3-example-product',
            extensionKey: 'example_product',
            moduleIdentifier: 'viewmend_example_product',
            category: 'Operations',
            position: 100,
            iconIdentifier: 'example-product-module-icon',
        );
    }
}

return [
    'viewmend_example_product' => [
        'parent' => 'viewmend',
        'access' => 'user',
        'path' => '/module/viewmend/example-product',
        // Product-specific module configuration follows.
    ],
];

use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use ViewMend\Typo3Core\Contract\ProductDashboardProviderInterface;
use ViewMend\Typo3Core\Product\ProductDashboardData;
use ViewMend\Typo3Core\Product\ProductMetric;

public function dashboardData(BackendUserAuthentication $user): ProductDashboardData
{
    return new ProductDashboardData(
        metadata: ['3 active rules'],
        metrics: [new ProductMetric('Accepted · 24h', '18')],
    );
}