PHP code example of php-soap / cached-engine

1. Go to this page and download the library: Download php-soap/cached-engine 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/ */

    

php-soap / cached-engine example snippets


use PhpSoap\CachedEngine\CachedEngine;
use Soap\CachedEngine\CacheConfig;
use Soap\Engine\Engine;

$engine = new CachedEngine(
    $yourPsr6CachePool,
    new CacheConfig(
        key: 'cached-engine',
        ttlInSeconds: 3600 
    ),
    static function (): Engine {
        return new YourSoapEngine();
    }
);

use PhpSoap\CachedEngine\CachedDriver;
use Soap\CachedEngine\CacheConfig;
use Soap\Driver\Driver;

$driver = new CachedDriver(
    $yourPsr6CachePool,
    new CacheConfig(
        key: 'cached-engine',
        ttlInSeconds: 3600 
    ),
    static function (): Driver {
        return new YourSoapDriver();
    }
);

use Soap\CachedEngine\CacheConfig;
use Soap\CachedEngine\CachedDriver;
use Soap\Encoding\Driver;
use Soap\Wsdl\Loader\StreamWrapperLoader;
use Soap\WsdlReader\Wsdl1Reader;
use Symfony\Component\Cache\Adapter\RedisAdapter;

$driver = new CachedDriver(
    new RedisAdapter(
        RedisAdapter::createConnection('redis://localhost')
    ),
    new CacheConfig('your-soap-driver', ttlInSeconds: 3600),
    static fn() => Driver::createFromWsdl1(
        (new Wsdl1Reader(
            new StreamWrapperLoader()
        ))($wsdlLocation)
    )
);
shell
composer install php-soap/cached-engine