barm / soap-bundle
Symfony 对 SoapClient 的包装
v0.0.4
2018-10-26 13:14 UTC
Requires
- php: ^7.1.3
- ext-soap: *
- symfony/config: ^4.1
- symfony/dependency-injection: ^4.1
- symfony/http-kernel: ^4.1
Requires (Dev)
- phpunit/phpunit: ^7
This package is auto-updated.
Last update: 2024-09-27 02:49:33 UTC
README
SoapBundle 为 PHP SoapClient 提供了可通过 Symfony WebProfiler 跟踪的功能。兼容 Symfony 4+。
特性
- 请求将在 WebProfiler 中记录
- 在 SoapRequest 后触发事件
安装
-
将此包添加到您的项目中作为 composer 依赖项
composer require barm/soap-bundle
-
在应用内核中添加此包
// 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
文件