php-soap/engine
Composer 安装命令:
composer require php-soap/engine
包简介
SOAP engine design
README 文档
README
This package contains the contracts and models that allow you to create a customizable SOAP engine. The design looks like this:
- Driver: A driver is a combination of an encoder + decoder + metadata that can work together in order to process SOAP requests.
- Encoder: Can encode mixed data into a valid SOAP Request.
- Decoder: Can decode a SOAP Response into a mixed data result.
- Metadata: Processes the WSDL and returns a collection of available types and methods.
- Transport: Sends the HTTP SOAP Request and receives the HTTP SOAP Response.
Every component above can be used seperately in order to create your own customized SOAP Engine.
Want to help out? 💚
Want more information about the future of this project? Check out this list of the next big projects we'll be working on.
Installation
composer install php-soap/engine
Engines
This package provides engines that can be used in a generic way:
SimpleEngine
The SimpleEngine is a wrapper around a previous defined Driver and a Transport implementation.
use Soap\Engine\SimpleEngine; $engine = new SimpleEngine($driver,$transport);
LazyEngine
You don't want to be loading WSDL files or SOAP services if you don't need to. By wrapping an engine in a lazy engine, you can prevent any WSDL loading from happening before actually requesting a resource.
use Soap\Engine\SimpleEngine; use Soap\Engine\LazyEngine; $engine = new LazyEngine(fn () => new SimpleEngine($driver, $transport));
Drivers
This package provides drivers that can be used in a generic way:
SimpleDriver
The SimpleEngine is a wrapper around a previous defined Encoder, Decoder and a Metadata implementation.
use Soap\Engine\SimpleDriver; $engine = new SimpleDriver($encoder, $decoder, $metadata);
PartialDriver
The PartialDriver is a wrapper around a previous defined Encoder, Decoder and a Metadata implementation.
It is possible to only provide one of the required items.
When some of the implementations are missing, it will throw a DriverException when the driver's method is invoked.
use Soap\Engine\PartialDriver; $engine = new PartialDriver(metadata: $metadata);
List of available components:
-
cached-engine: Provides wrappers for storing engines and encoders in a PSR-6 Cache pool.
- CachedDriver: Decorates a cache around a driver factory.
- CachedEngine: Decorates a cache around an engine factory.
-
ext-soap-engine: An engine based on PHP's ext-soap.
- ExtSoapEncoder: Uses PHP's
SoapClientin order to encode a mixed request body into a SOAP request. - ExtSoapDecoder: Uses PHP's
SoapClientin order to decode a SOAP Response into mixed data. - ExtSoapMetadata: Parses the methods and types from PHP's
SoapClientinto something more usable. - ExtSoapDriver: Combines the ext-soap encoder, decoder and metadata tools into a usable
ext-soappreset. - ExtSoapClientTransport: Uses PHP's
SoapClientto handle SOAP requests. - ExtSoapServerTransport: Uses PHP's
SoapServerto handle SOAP requests. - TraceableTransport: Can be used to decorate another transport and keeps track of the last request and response.
- ExtSoapEncoder: Uses PHP's
-
psr18-transport: Leverages your PSR-18 HTTP client to deal with the HTTP Layer.
- Psr18Transport: Uses a PSR-18 HTTP client to handle SOAP requests. You can also use fiber-based Async clients!
- Provides middleware to deal with some common SOAP quirks.
-
wsdl-reader: Provides an XML based PHP implementation for collecting WSDL meta-data.
- Wsdl1MetadataProvider: Provides the methods and types from any WSDL 1 document.
-
encoding: Provides a pure PHP drop-in replacement for the ext-soap encoding logic.
- Driver: Combines the encoder, decoder and wsdl-reader metadata into a usable vanilla PHP preset.
- Encoder: Encodes mixed data into a valid SOAP Request.
- Decoder: Decodes a SOAP Response into mixed data.
Creating your own engine
Every component of the engine has its own interface. You can choose to build an entire engine or a specific component. The interfaces look like this:
Testing your engine
To make sure that all components have the same end-result, we provide a set of integration tests that can be used to test your custom components.
Usage:
composer require --dev php-soap/engine-integration-tests
This will make following test cases available:
- AbstractDecoderTest: Can be used to test a custom
Decoder. - AbstractEncoderTest: Can be used to test a custom
Encoder. - AbstractEngineTest: : Can be used to test a custom
EngineorTransport. - AbstractMetadataProviderTest: : Can be used to test a custom
MetadataorMetadataProvider.
php-soap/engine 适用场景与选型建议
php-soap/engine 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.92M 次下载、GitHub Stars 达 27, 最近一次更新时间为 2021 年 07 月 07 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 php-soap/engine 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 php-soap/engine 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 3.92M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 27
- 点击次数: 11
- 依赖项目数: 12
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-07-07
