PHPackages                             goetas-webservices/soap-server - 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. goetas-webservices/soap-server

ActiveLibrary[API Development](/categories/api)

goetas-webservices/soap-server
==============================

Pure PHP implementation of SOAP 1.1 and 1.2 server

0.1.2(3y ago)186.6k4[1 issues](https://github.com/goetas-webservices/soap-server/issues)MITPHPPHP ^7.2CI failing

Since Jan 3Pushed 3y ago4 watchersCompare

[ Source](https://github.com/goetas-webservices/soap-server)[ Packagist](https://packagist.org/packages/goetas-webservices/soap-server)[ RSS](/packages/goetas-webservices-soap-server/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (3)Dependencies (16)Versions (4)Used By (0)

goetas-webservices / soap-server
================================

[](#goetas-webservices--soap-server)

[![Build Status](https://camo.githubusercontent.com/b1ee801588e08286bd300e67c9f899dc40dae6970a0ee882ee7304b0204dc63b/68747470733a2f2f7472617669732d63692e6f72672f676f657461732d77656273657276696365732f736f61702d7365727665722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/goetas-webservices/soap-server)

PHP implementation of SOAP 1.1 and 1.2 server specifications.

Strengths:

- Pure PHP, no dependencies on `ext-soap`
- Extensible (JMS event listeners support)
- PSR-7 HTTP messaging
- PSR-15 HTTP server handlers
- No WSDL/XSD parsing on production
- IDE type hinting support

Only document/literal style is supported and the webservice should follow the [WS-I](https://en.wikipedia.org/wiki/WS-I_Basic_Profile) guidelines.

There are no plans to support the deprecated rpc and encoded styles. Webservices not following the WS-I specifications might work, but they are officially not supported.

Demo
----

[](#demo)

[goetas-webservices/soap-server-demo](https://github.com/goetas-webservices/soap-server-demo) is a demo project that shows how to produce a SOAP server in a generic PHP web application.

Installation
------------

[](#installation)

The recommended way to install goetas-webservices / soap-server is using [Composer](https://getcomposer.org/):

Add this packages to your `composer.json` file.

```
{
    "require": {
        "goetas-webservices/soap-server": "^0.1",
    },
    "require-dev": {
        "goetas-webservices/wsdl2php": "^0.5.1",
    },
}

```

How to
======

[](#how-to)

To improve performance, this library is based on the concept that all the SOAP/WSDL metadata has to be compiled into PHP compatible metadata (in reality is a big plain PHP array, so is really fast).

To do this we have to define a configuration file (in this case called `config.yml`) that holds some important information.

Here is an example:

```
# config.yml

soap_server:
   namespaces:
    'http://www.example.org/test/': 'TestNs/MyApp'
  destinations_php:
    'TestNs/MyApp': soap/src
  destinations_jms:
    'TestNs/MyApp': soap/metadata
  aliases:
    'http://www.example.org/test/':
      MyCustomXSDType:  'MyCustomMappedPHPType'

  metadata:
    'test.wsdl': ~
```

This file has some important sections:

### WSDL Specific

[](#wsdl-specific)

- `metadata` specifies where are placed WSDL files that will be used to generate al the required PHP metadata.

### XML/XSD Specific

[](#xmlxsd-specific)

- `namespaces` (required) defines the mapping between XML namespaces and PHP namespaces. (in the example we have the `http://www.example.org/test/` XML namespace mapped to `TestNs\MyApp`)
- `destinations_php` (required) specifies the directory where to save the PHP classes that belongs to `TestNs\MyApp` PHP namespace. (in this example `TestNs\MyApp` classes will ne saved into `soap/src` directory.
- `destinations_jms` (required) specifies the directory where to save JMS Serializer metadata files that belongs to `TestNs\MyApp` PHP namespace. (in this example `TestNs\MyApp` metadata will ne saved into `soap/metadata` directory.
- `aliases` (optional) specifies some mappings that are handled by custom JMS serializer handlers. Allows to specify to do not generate metadata for some XML types, and assign them directly a PHP class. For that PHP class is necessary to create a custom JMS serialize/deserialize handler.

Metadata generation
-------------------

[](#metadata-generation)

In order to be able to use the SOAP server we have to generate some metadata and PHP classes.

To do it we can run:

```
bin/soap-server generate \
 tests/config.yml \
 --dest-class=GlobalWeather/Container/SoapServerContainer \
 soap/src-gw/Container
```

- `bin/soap-server generate` is the command we are running
- `tests/config.yml` is a path to our configuration file
- `--dest-class=GlobalWeather/Container/SoapServerContainer` allows to specify the fully qualified class name of the container class that will hold all the webservice metadata.
- `soap/src/Container` is the path where to save the container class that holds all the webservice metadata (you will have to configure the auto loader to load it)

Using the server
----------------

[](#using-the-server)

Once all the metadata are generated we can use our SOAP server.

Let's see a minimal example:

```
// composer auto loader
require __DIR__ . '/vendor/autoload.php';

// instantiate the main container class
// the name was defined by --dest-class=GlobalWeather/Container/SoapServerContainer
// parameter during the generation process
$container = new SoapServerContainer();

// create a JMS serializer instance
$serializer = SoapContainerBuilder::createSerializerBuilderFromContainer($container)->build();
// get the metadata from the container
$metadata = $container->get('goetas_webservices.soap.metadata_reader');

$handler = new class() {
    function anAction($someParam)
    {
        return 'OK 123';
    }

    function someAction($someParam, HeadersIncoming $headersIncoming)
    {
        $headers = $headersIncoming->getRawheader();

        // perform some checks on $headers here

        return 'OK 123';
    }

    function anotherAction($someParam, HeadersOutgoing $headersOutgoing)
    {
        // reply with custom headers
        $headersOutgoing->addHeader(new Header(new SomeHeaderData()));

        // reply with custom headers in pure xml
        $dom = new DOMDocument();
        $dom->appendChild($dom->createElement('foo', 'bar'));
        $headersOutgoing->addHeader(new Header($dom->documentElement));

        return 'OK 456';
    }

    function someErrAction($someParam)
    {
        throw new CustomExcpetion(); // converted in a soap fault
    }
};

$router = new DefaultRouter(new ConfiguredRoute($handler));

$factory = new ServerFactory($metadata, $serializer, $router);

 // get the soap server
$server = $factory->getServer('test.wsdl');

// create psr7 request
$request = \Laminas\Diactoros\ServerRequestFactory::fromGlobals();

// let the server handle the request
$response = $server->handle($request);

// send the response to the client (using laminas/laminas-httphandlerrunner)
$emitter = new \Laminas\HttpHandlerRunner\Emitter\SapiEmitter();
$emitter->emit($response);
```

Note
----

[](#note)

The code in this project is provided under the [MIT](https://opensource.org/licenses/MIT) license. For professional support contact or visit

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 98.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 ~331 days

Total

3

Last Release

1340d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/776743?v=4)[Asmir Mustafic](/maintainers/goetas)[@goetas](https://github.com/goetas)

---

Top Contributors

[![goetas](https://avatars.githubusercontent.com/u/776743?v=4)](https://github.com/goetas "goetas (75 commits)")[![riccardonar](https://avatars.githubusercontent.com/u/5285820?v=4)](https://github.com/riccardonar "riccardonar (1 commits)")

---

Tags

phpsoapsoap-serverwebserviceswsdl

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/goetas-webservices-soap-server/health.svg)

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

###  Alternatives

[telnyx/telnyx-php

Official Telnyx PHP SDK — APIs for Voice, SMS, MMS, WhatsApp, Fax, SIP Trunking, Wireless IoT, Call Control, and more. Build global communications on Telnyx's private carrier-grade network.

35729.6k2](/packages/telnyx-telnyx-php)[cakephp/cakephp

The CakePHP framework

8.8k19.1M1.7k](/packages/cakephp-cakephp)[phpro/http-tools

HTTP tools for developing more consistent HTTP implementations.

28146.3k](/packages/phpro-http-tools)[flow-php/flow

PHP ETL - Extract Transform Load - Data processing framework

84735.1k](/packages/flow-php-flow)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k5.8M712](/packages/sylius-sylius)[tempest/framework

The PHP framework that gets out of your way.

2.2k31.1k12](/packages/tempest-framework)

PHPackages © 2026

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