Skip to content

Latest commit

 

History

51 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Asynchronous SOAP client

codecov.io workflow

An asynchronous SOAP client built on top of Guzzle. SoapClient implements meng-tian/php-async-soap.

Requirements

PHP 8.2 or newer with ext-soap, and Guzzle 7. PHP 7.x and PHP 8.0-8.1 remain available only through older releases.

Install

composer require meng-tian/async-soap-guzzle:^0.4.2

Usage

Meng\AsyncSoap\Guzzle\Factory requires a Psr\Http\Message\RequestFactoryInterface and a Psr\Http\Message\StreamFactoryInterface. These are PSR-17 factories for creating PSR-7 HTTP messages. Use any PSR-17 implementation; the examples below use laminas/laminas-diactoros.

  1. Install a PSR-17 implementation if your application does not already provide one:
...
    "require": {
        "php": "^8.2",
        "meng-tian/async-soap-guzzle": "^0.4.2",
        "laminas/laminas-diactoros": "^3.8"
    },
...

You can replace laminas/laminas-diactoros with another PSR-17 implementation.

  1. Run composer install

  2. Create your async SOAP client and call your SOAP messages:

use GuzzleHttp\Client;
use Meng\AsyncSoap\Guzzle\Factory;
use Laminas\Diactoros\RequestFactory;
use Laminas\Diactoros\StreamFactory;

$factory = new Factory();
$client = $factory->create(
    new Client(),
    new StreamFactory(),
    new RequestFactory(),
    'http://www.webservicex.net/Statistics.asmx?WSDL'
);

// Async call
$promise = $client->callAsync('GetStatistics', [['X' => [1,2,3]]]);
$result = $promise->wait();

// Sync call
$result = $client->call('GetStatistics', [['X' => [1,2,3]]]);

// Magic method
$promise = $client->GetStatistics(['X' => [1,2,3]]);
$result = $promise->wait();

Testing

composer install
vendor/bin/phpunit

License

This library is released under MIT license.

About

An asynchronous SOAP client build on top of Guzzle.

Topics

Resources

Stars

96 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages