PHPackages                             tuscanicz/soap - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. tuscanicz/soap

ActiveLibrary[API Development](/categories/api)

tuscanicz/soap
==============

A largely refactored besimple/soap used to build SOAP and WSDL based web services. This fork fixes a lot of errors and provides better API, robust, stable and modern codebase.

v4.4.7(8y ago)838.8k—0%7[3 issues](https://github.com/tuscanicz/BeSimpleSoap/issues)[1 PRs](https://github.com/tuscanicz/BeSimpleSoap/pulls)MITPHPPHP &gt;=5.3.0|&gt;=7.0

Since Nov 6Pushed 5y ago4 watchersCompare

[ Source](https://github.com/tuscanicz/BeSimpleSoap)[ Packagist](https://packagist.org/packages/tuscanicz/soap)[ RSS](/packages/tuscanicz-soap/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (8)Versions (34)Used By (0)

BeSimpleSoap
============

[](#besimplesoap)

Build SOAP and WSDL based web services. This fork is a refactored version that fixes a lot of errors and provides better API, robust, stable and modern codebase. See [How to use](#how-to-use) that will help you to understand the magic.

Components
==========

[](#components)

BeSimpleSoap consists of five components ...

BeSimpleSoapClient
------------------

[](#besimplesoapclient)

**Refactored** BeSimpleSoapClient is a component that extends the native PHP SoapClient with further features like SwA and WS-Security.

BeSimpleSoapServer
------------------

[](#besimplesoapserver)

**Refactored** BeSimpleSoapServer is a component that extends the native PHP SoapServer with further features like SwA and WS-Security.

BeSimpleSoapCommon
------------------

[](#besimplesoapcommon)

**Refactored** BeSimpleSoapCommon component contains functionality shared by both the server and client implementations.

BeSimpleSoapWsdl
----------------

[](#besimplesoapwsdl)

**Untouched!**The component is not affected by refactoring so it should work properly. For further information see the original [README](https://github.com/BeSimple/BeSimpleSoap/blob/master/src/BeSimple/SoapWsdl/README.md).

BeSimpleSoapBundle
------------------

[](#besimplesoapbundle)

**Unsupported!**The BeSimpleSoapBundle is a Symfony2 bundle to build WSDL and SOAP based web services. For further information see the the original [README](https://github.com/BeSimple/BeSimpleSoap/blob/master/src/BeSimple/SoapBundle/README.md). *Will not work since the Symfony libraries were removed and usages of other components were not refactored. Feel free to fork this repository and fix it!*

Installation
============

[](#installation)

If you do not yet have composer, install it like this:

```
curl -s http://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin
```

Create a `composer.json` file:

```
{
    "require": {
        "tuscanicz/soap": "^4.2"
    }
}
```

Now you are ready to install the library:

```
php /usr/local/bin/composer.phar install
```

How to use
==========

[](#how-to-use)

You can investigate the unit tests dir `tests` in order to get a clue. Forget about associative arrays, vague configurations, multiple extension and silent errors! This may look a bit more complex at the first sight, but it will guide you to configure and set up your client or server properly.

Example of soap client call
---------------------------

[](#example-of-soap-client-call)

```
$soapClientBuilder = new SoapClientBuilder();
$soapClient = $soapClientBuilder->build(
    SoapClientOptionsBuilder::createWithDefaults(),
    SoapOptionsBuilder::createWithDefaults('http://path/to/wsdlfile.wsdl')
);
$myRequest = new MyRequest();
$myRequest->attribute = 'string value';
$soapResponse = $soapClient->soapCall('myMethod', [$myRequest]);

var_dump($soapResponse); // Contains Response, Attachments
```

### Something wrong?!

[](#something-wrong)

Turn on the tracking and catch `SoapFaultWithTracingData` exception to get some sweets :)

```
try {
    $soapResponse = $soapClient->soapCall('myMethod', [$myRequest]);
} catch (SoapFaultWithTracingData $fault) {
    var_dump($fault->getSoapResponseTracingData()->getLastRequest());
}
```

In this example, a `MyRequest` object has been used to describe request. Using a ClassMap, you help SoapClient to turn it into XML request.

Example of soap server handling
-------------------------------

[](#example-of-soap-server-handling)

Starting a SOAP server is a bit more complex. I recommend you to inspect SoapServer unit tests for inspiration.

```
$dummyService = new DummyService();
$classMap = new ClassMap();
foreach ($dummyService->getClassMap() as $type => $className) {
    $classMap->add($type, $className);
}
$soapServerBuilder = new SoapServerBuilder();
$soapServerOptions = SoapServerOptionsBuilder::createWithDefaults($dummyService);
$soapOptions = SoapOptionsBuilder::createWithClassMap($dummyService->getWsdlPath(), $classMap);
$soapServer = $soapServerBuilder->build($soapServerOptions, $soapOptions);

$request = $soapServer->createRequest(
    $dummyService->getEndpoint(),
    'DummyService.dummyServiceMethod',
    'text/xml;charset=UTF-8',
    ''
);
$response = $soapServer->handleRequest($request);

var_dump($response); // Contains Response, Attachments
```

In this example, a `DummyService` service has been used to handle request. Using a service can help you create coherent SoapServer endpoints. Service can hold an endpoint URL, WSDL path and a class map as associative array. You can hold a class map as `ClassMap` object directly in the `DummyService` instead of array.

In the service you should describe SOAP methods from given WSDL. In the example, the dummyServiceMethod is called. The method will receive request object and return response object that are matched according to the class map.

See a simplified implementation of `dummyServiceMethod` to get a clue:

```
    /**
     * @param DummyServiceRequest $dummyServiceRequest
     * @return DummyServiceResponse
     */
    public function dummyServiceMethod(DummyServiceRequest $dummyServiceRequest)
    {
        $response = new DummyServiceResponse();
        $response->status = true;

        return $response;
    }

```

For further information and getting inspiration for your implementation, see the unit tests in `tests` dir.

Contribute
==========

[](#contribute)

[![Build Status](https://camo.githubusercontent.com/4eb0751f69fa306bf655cd7068eeca6af41d7c1358123967b5f05840c1d8e8c4/68747470733a2f2f7472617669732d63692e6f72672f74757363616e69637a2f426553696d706c65536f61702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/tuscanicz/BeSimpleSoap)

Feel free to contribute! Please, run the tests via Phing `php phing -f build.xml`.

**Warning:** Unit tests may fail under Windows OS, tested under Linux, MacOS.

###  Health Score

38

—

LowBetter than 86% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community23

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 53.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~48 days

Total

33

Last Release

2966d ago

Major Versions

v0.4 → v4.12017-02-14

PHP version history (2 changes)v0.1.0PHP &gt;=5.3.0

v4.1PHP &gt;=5.3.0|&gt;=7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/93ce7a9d00f3e4feb28a3884b7f27a929ea76cecb27bc06fa29df75d66a44d63?d=identicon)[tuscanicz](/maintainers/tuscanicz)

---

Top Contributors

[![francisbesset](https://avatars.githubusercontent.com/u/471525?v=4)](https://github.com/francisbesset "francisbesset (305 commits)")[![aschamberger](https://avatars.githubusercontent.com/u/1042049?v=4)](https://github.com/aschamberger "aschamberger (97 commits)")[![christiankerl](https://avatars.githubusercontent.com/u/425341?v=4)](https://github.com/christiankerl "christiankerl (72 commits)")[![tuscanicz](https://avatars.githubusercontent.com/u/5862953?v=4)](https://github.com/tuscanicz "tuscanicz (63 commits)")[![cameronmurphy](https://avatars.githubusercontent.com/u/1300032?v=4)](https://github.com/cameronmurphy "cameronmurphy (7 commits)")[![mremi](https://avatars.githubusercontent.com/u/548536?v=4)](https://github.com/mremi "mremi (5 commits)")[![alemorozov](https://avatars.githubusercontent.com/u/1452075?v=4)](https://github.com/alemorozov "alemorozov (4 commits)")[![sarunas](https://avatars.githubusercontent.com/u/250523?v=4)](https://github.com/sarunas "sarunas (2 commits)")[![milanmimra](https://avatars.githubusercontent.com/u/11173214?v=4)](https://github.com/milanmimra "milanmimra (2 commits)")[![lsmith77](https://avatars.githubusercontent.com/u/300279?v=4)](https://github.com/lsmith77 "lsmith77 (2 commits)")[![vytautasgimbutas](https://avatars.githubusercontent.com/u/1172971?v=4)](https://github.com/vytautasgimbutas "vytautasgimbutas (1 commits)")[![ceesco53](https://avatars.githubusercontent.com/u/2687998?v=4)](https://github.com/ceesco53 "ceesco53 (1 commits)")[![ch3ric](https://avatars.githubusercontent.com/u/858068?v=4)](https://github.com/ch3ric "ch3ric (1 commits)")[![davefx](https://avatars.githubusercontent.com/u/292309?v=4)](https://github.com/davefx "davefx (1 commits)")[![hason](https://avatars.githubusercontent.com/u/288535?v=4)](https://github.com/hason "hason (1 commits)")[![ldantunez](https://avatars.githubusercontent.com/u/2373448?v=4)](https://github.com/ldantunez "ldantunez (1 commits)")[![matthiasnoback](https://avatars.githubusercontent.com/u/1193078?v=4)](https://github.com/matthiasnoback "matthiasnoback (1 commits)")[![rolebi](https://avatars.githubusercontent.com/u/2950183?v=4)](https://github.com/rolebi "rolebi (1 commits)")[![vaclav-horky](https://avatars.githubusercontent.com/u/120029717?v=4)](https://github.com/vaclav-horky "vaclav-horky (1 commits)")

---

Tags

soapsoap-clientsoap-serversoap-servicessoap-web-servicessoapsoap-clientsoap server

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/tuscanicz-soap/health.svg)

```
[![Health](https://phpackages.com/badges/tuscanicz-soap/health.svg)](https://phpackages.com/packages/tuscanicz-soap)
```

###  Alternatives

[besimple/soap-client

Build and consume SOAP Client based web services

582.2M13](/packages/besimple-soap-client)[besimple/soap

Build and consume SOAP and WSDL based web services

112559.7k2](/packages/besimple-soap)[laminas/laminas-soap

6321.3M32](/packages/laminas-laminas-soap)[gusapi/gusapi

Gus Api Library for PHP

1351.5M8](/packages/gusapi-gusapi)[codedredd/laravel-soap

A SoapClient wrapper integration for Laravel

221500.6k3](/packages/codedredd-laravel-soap)[freshcells/soap-client-bundle

SoapClientBundle for symfony

36149.2k](/packages/freshcells-soap-client-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
