1. Go to this page and download the library: Download nhkey/yii2-soap 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/ */
nhkey / yii2-soap example snippets
'components' => [
'soapClient' => [
'class' => \nhkey\soap\SoapClientWrapper::className(),
'url' => '<SOAP_WSDL_URL>',
// SoapClient options
'options' => [
'cache_wsdl' => WSDL_CACHE_NONE,
'debug' => true,
],
// SopaClient headers, object or closure
'headers' => function() {
$headers = new stdClass();
$headers->authDetails = new stdClass(); // This is node in SOAP Header where the login and password.
$headers->authDetails->login = 'LOGIN';
$headers->authDetails->password = 'PASSWORD';
return $headers;
}
],
...
]