m-comscience/yii2-soap-client

SOAP Client Extension for Yii 2

dev-master 2020-01-30 15:09 UTC

This package is auto-updated.

Last update: 2024-03-29 03:51:38 UTC


README

Installation

The preferred way to install this extension is through composer.

Either run

composer require m-comscience/yii2-soap-client "@dev"

or add

"m-comscience/yii2-soap-client": "@dev"

to the require section of your composer.json file.

Usage

You need to setup soap client application component:

'components' => [
    'soapClient' => [
        'class' => 'mcomscience\soapclient\Client',
        'url' => 'http://myservice.com/api',
        'options' => [
            'cache_wsdl' => WSDL_CACHE_NONE,
        ],
    ]
    ...
]

or define the client directly in the code:

$client = new \mcomscience\soapclient\Client([
    'url' => 'http://myservice.com/api',
]);

Example of calling the SOAP function:

$client = Yii::$app->soapClient;
echo $client->getFunction();