Download the PHP package paxport/soap-react without Composer

On this page you can find all versions of the php package paxport/soap-react. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package soap-react

clue/reactphp-soap Build Status

Simple, async SOAP web service client library, built on top of ReactPHP.

Most notably, SOAP is often used for invoking Remote procedure calls (RPCs) in distributed systems. Internally, SOAP messages are encoded as XML and usually sent via HTTP POST requests. For the most part, SOAP (originally Simple Object Access protocol) is a protocol of the past, and in fact anything but simple. It is still in use by many (often legacy) systems. This project provides a simple API for invoking async RPCs to remote web services.

Table of contents

Quickstart example

Once installed, you can use the following code to query an example web service via SOAP:

See also the examples.

Usage

Client

The Client class is responsible for communication with the remote SOAP WebService server.

It requires a Browser object bound to the main EventLoop in order to handle async requests, the WSDL file contents and an optional array of SOAP options:

If you need custom connector settings (DNS resolution, TLS parameters, timeouts, proxy servers etc.), you can explicitly pass a custom instance of the ConnectorInterface to the Browser instance:

The Client works similar to PHP's SoapClient (which it uses under the hood), but leaves you the responsibility to load the WSDL file. This allows you to use local WSDL files, WSDL files from a cache or the most common form, downloading the WSDL file contents from an URL through the Browser:

The Client constructor loads the given WSDL file contents into memory and parses its definition. If the given WSDL file is invalid and can not be parsed, this will throw a SoapFault:

Note that if you have ext-xdebug loaded, this may halt with a fatal error instead of throwing a SoapFault. It is not recommended to use this extension in production, so this should only ever affect test environments.

The Client constructor accepts an array of options. All given options will be passed through to the underlying SoapClient. However, not all options make sense in this async implementation and as such may not have the desired effect. See also SoapClient documentation for more details.

If working in WSDL mode, the $options parameter is optional. If working in non-WSDL mode, the WSDL parameter must be set to null and the options parameter must contain the location and uri options, where location is the URL of the SOAP server to send the request to, and uri is the target namespace of the SOAP service:

Similarly, if working in WSDL mode, the location option can be used to explicitly overwrite the URL of the SOAP server to send the request to:

You can use the soap_version option to change from the default SOAP 1.1 to use SOAP 1.2 instead:

You can use the classmap option to map certain WSDL types to PHP classes like this:

The proxy_host option (and family) is not supported by this library. As an alternative, you can configure the given $browser instance to use an HTTP proxy server. If you find any other option is missing or not supported here, PRs are much appreciated!

All public methods of the Client are considered advanced usage. If you want to call RPC functions, see below for the Proxy class.

soapCall()

The soapCall(string $method, mixed[] $arguments): PromiseInterface<mixed, Exception> method can be used to queue the given function to be sent via SOAP and wait for a response from the remote web service.

Note: This is considered advanced usage, you may want to look into using the Proxy instead.

getFunctions()

The getFunctions(): string[]|null method can be used to return an array of functions defined in the WSDL.

It returns the equivalent of PHP's SoapClient::__getFunctions(). In non-WSDL mode, this method returns null.

getTypes()

The getTypes(): string[]|null method can be used to return an array of types defined in the WSDL.

It returns the equivalent of PHP's SoapClient::__getTypes(). In non-WSDL mode, this method returns null.

getLocation()

The getLocation(string|int $function): string method can be used to return the location (URI) of the given webservice $function.

Note that this is not to be confused with the WSDL file location. A WSDL file can contain any number of function definitions. It's very common that all of these functions use the same location definition. However, technically each function can potentially use a different location.

The $function parameter should be a string with the the SOAP function name. See also getFunctions() for a list of all available functions.

For easier access, this function also accepts a numeric function index. It then uses getFunctions() internally to get the function name for the given index. This is particularly useful for the very common case where all functions use the same location and accessing the first location is sufficient.

When the location option has been set in the Client constructor (such as when in non-WSDL mode) or via the withLocation() method, this method returns the value of the given location.

Passing a $function not defined in the WSDL file will throw a SoapFault.

withLocation()

The withLocation(string $location): self method can be used to return a new Client with the updated location (URI) for all functions.

Note that this is not to be confused with the WSDL file location. A WSDL file can contain any number of function definitions. It's very common that all of these functions use the same location definition. However, technically each function can potentially use a different location.

As an alternative to this method, you can also set the location option in the Client constructor (such as when in non-WSDL mode).

Proxy

The Proxy class wraps an existing Client instance in order to ease calling SOAP functions.

Note that this class is called "Proxy" because it will forward (proxy) all method calls to the actual SOAP service via the underlying Client::soapCall() method. This is not to be confused with using a proxy server. See Client documentation for more details on how to use an HTTP proxy server.

Functions

Each and every method call to the Proxy class will be sent via SOAP.

Please refer to your WSDL or its accompanying documentation for details on which functions and arguments are supported.

Promises

Issuing SOAP functions is async (non-blocking), so you can actually send multiple RPC requests in parallel. The web service will respond to each request with a return value. The order is not guaranteed. Sending requests uses a Promise-based interface that makes it easy to react to when a request is fulfilled (i.e. either successfully resolved or rejected with an error):

Cancellation

The returned Promise is implemented in such a way that it can be cancelled when it is still pending. Cancelling a pending promise will reject its value with an Exception and clean up any underlying resources.

Timeouts

This library uses a very efficient HTTP implementation, so most SOAP requests should usually be completed in mere milliseconds. However, when sending SOAP requests over an unreliable network (the internet), there are a number of things that can go wrong and may cause the request to fail after a time. As such, timeouts are handled by the underlying HTTP library and this library respects PHP's default_socket_timeout setting (default 60s) as a timeout for sending the outgoing SOAP request and waiting for a successful response and will otherwise cancel the pending request and reject its value with an Exception.

Note that this timeout value covers creating the underlying transport connection, sending the SOAP request, waiting for the remote service to process the request and receiving the full SOAP response. To pass a custom timeout value, you can assign the underlying timeout option like this:

Similarly, you can use a negative timeout value to not apply a timeout at all or use a null value to restore the default handling. Note that the underlying connection may still impose a different timeout value. See also the underlying timeout option for more details.

Install

The recommended way to install this library is through Composer. New to Composer?

This project follows SemVer. This will install the latest supported version:

See also the CHANGELOG for details about version upgrades.

This project aims to run on any platform and thus only requires ext-soap and supports running on legacy PHP 5.3 through current PHP 7+ and HHVM. It's highly recommended to use PHP 7+ for this project.

Tests

To run the test suite, you first need to clone this repo and then install all dependencies through Composer:

To run the test suite, go to the project root and run:

The test suite also contains a number of functional integration tests that rely on a stable internet connection. If you do not want to run these, they can simply be skipped like this:

License

This project is released under the permissive MIT license.

Did you know that I offer custom development services and issuing invoices for sponsorships of releases and for contributions? Contact me (@clue) for details.


All versions of soap-react with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3
clue/buzz-react Version ^2.5
react/event-loop Version ^1.0 || ^0.5 || ^0.4 || ^0.3
react/promise Version ^2.1 || ^1.2
ext-soap Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package paxport/soap-react contains the following files

Loading the files please wait ....