barm/

soap-bundle

Symfony 对 SoapClient 的包装

安装: 18

依赖者: 0

建议者: 0

安全: 0

星标: 0

关注者: 2

分支: 5

类型:symfony-bundle

v0.0.4 2018-10-26 13:14 UTC

This package is auto-updated.

Last update: 2024-09-27 02:49:33 UTC


README

SoapBundle 为 PHP SoapClient 提供了可通过 Symfony WebProfiler 跟踪的功能。兼容 Symfony 4+。

SoapBundle Promo

特性

  • 请求将在 WebProfiler 中记录
  • 在 SoapRequest 后触发事件

安装

  1. 将此包添加到您的项目中作为 composer 依赖项

    composer require barm/soap-bundle
  2. 在应用内核中添加此包

    // app/AppKernel.php
    public function registerBundles()
    {
        // ...
        $bundles[] = new Barm\Bundle\SoapBundle\BarmSoapBundle();
    
        return $bundles;
    }

使用

您应该通过 $container->get('barm_soap.factory')->create($wsdl, $optionalOptions) 创建 SoapClient 实例,而不是像 new \SoapClient($wsdl, $optionalOptions) 这样创建,这样返回的是一个 SoapClient 实例。

// Old way
$oldSoapClient = new \SoapClient($wsdl);

// New way
$client = $container->get('barm_soap.factory')->create($wsdl);
# Old Way
services:
    old_soap_client:
        class: SoapClient
        arguments: ["%wsdl_url%"]

# New Way
services:
    new_soap_client:
        class: SoapClient
        factory: ["@barm_soap.factory", create]
        arguments: ["%wsdl_url%"]

许可证

SoapBundle 在 MIT 许可证下授权 - 详细信息请参阅 LICENSE 文件