nyx-solutions/yii2-http-soap-client

Yii2 HTTP SOAP 客户端

5.0.0 2022-06-02 14:59 UTC

This package is auto-updated.

Last update: 2024-08-30 01:27:15 UTC


README

Yii2 组件,用于SOAP请求。

Latest Stable Version Total Downloads Latest Unstable Version License Monthly Downloads Daily Downloads composer.lock

安装

安装此扩展的首选方式是通过 Composer

  • 运行以下命令
php composer.phar require --prefer-dist "nyx-solutions/yii2-http-soap-client" "*"

或添加

"nyx-solutions/yii2-http-soap-client": "*"

到您的应用程序的 composer.json 文件的 require 部分。

使用方法

  • 在您的应用程序的配置文件中配置 HttpSoapClient 组件,例如
'components' => [
    'soapApi' => [
        'class'    => 'nyx\http\soap\HttpSoapClient',
        'endpoint' => 'http://ws.exemple.com/WebService.asmx?wsdl',
        'options'  => [
            'cache_wsdl' => WSDL_CACHE_NONE
        ]
    ]
]

或者您可以直接在代码中定义 HttpSoapClient

use nyx\http\soap\HttpSoapClient;

$client = new HttpSoapClient(['endpoint' => 'http://ws.exemple.com/WebService.asmx?wsdl']);

配置步骤完成后,您可以按如下方式调用SOAP方法(其中 getMessage 是您的SOAP方法)

echo $client->getMessage('Lorem ipsum...');

许可证

yii2-http-soap-client 在BSD 3-Clause许可证下发布。有关详细信息,请参阅附带文件 LICENSE.md

Yii2