PHP code example of ssch / typo3-psr-cache-adapter

1. Go to this page and download the library: Download ssch/typo3-psr-cache-adapter 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/ */

    

ssch / typo3-psr-cache-adapter example snippets


use Psr\Cache\CacheItemPoolInterface;
use Ssch\Cache\Factory\Psr6Factory;
use MyNamespace\MyExtensionKey\Service\MyService;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use function Symfony\Component\DependencyInjection\Loader\Configurator\service;

return static function (ContainerConfigurator $containerConfigurator): void {
    $services = $containerConfigurator->services();
    $services->defaults()
        ->autowire()
        ->private()
        ->autoconfigure();

    $services->set('cache.psr6.typo3_psr_cache_adapter_test', CacheItemPoolInterface::class)
        ->factory([service(Psr6Factory::class), 'create'])
        ->args(['typo3_psr_cache_adapter_test']);
    $services->set(MyService::class)
        ->args([service('cache.psr6.typo3_psr_cache_adapter_test')]);
};