PHP code example of sourcetoad / soapy

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

    

sourcetoad / soapy example snippets


$this->client = SoapyFacade::create(function (SoapyCurtain $curtain) {
    return $curtain
        ->setWsdl('https://example.org?wsdl')
        ->setTrace(true)
        ->setOptions([
            'encoding' => 'UTF-8'
        ])
        ->setClassMap([
            'Foo' => Foo::class,
            'FooResponse' => FooResponse::class
        ])
        ->setCache(WSDL_CACHE_MEMORY)
        ->setLocation('https://example.org');
});


class Foo {
    protected $bar;
    protected $baz;
    
    public function __construct(string $bar, bool $baz) {
        $this->bar = $bar;
        $this->baz = $baz;
    }
}

$this->client->call('fizz', new Foo("Connor", true));


class FooResponse {
    protected $status;
}

echo $this->client->call('fizz', new Foo("Connor", true))->status;
// Success.

$this->client = SoapyFacade::create(function (SoapyCurtain $curtain) {
    return $curtain
        ->setWsdl('https://example.org?wsdl')
});

$this->client->call('fizz', [
    'bar' => 'Connor',
    'baz' => true
});


class CustomClass extends \Sourcetoad\Soapy\SoapyBaseClient {
    //
}

$this->client = SoapyFacade::create(function (SoapyCurtain $curtain) {
    return $curtain
        ->setWsdl('https://example.org?wsdl')
}, CustomClass::class);