PHPackages                             dgame/php-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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. dgame/php-soap

AbandonedArchivedLibrary[Parsing &amp; Serialization](/categories/parsing)

dgame/php-soap
==============

php soap

v0.8.5(8y ago)530.7k↓50%21MITPHPPHP &gt;=7.0

Since Jan 9Pushed 6y ago5 watchersCompare

[ Source](https://github.com/Dgame/php-soap)[ Packagist](https://packagist.org/packages/dgame/php-soap)[ Docs](https://github.com/php-soap)[ RSS](/packages/dgame-php-soap/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (4)Versions (16)Used By (1)

php-soap
========

[](#php-soap)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/f37fa6a7ef37de6736f5f8d2bea87a0e25092dd6a5c9f038ecb312498b67c1b3/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4467616d652f7068702d736f61702f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Dgame/php-soap/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/aac0475ca14585391731d8f41ac20f176bff88ec1d17376961598d9f1375de03/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4467616d652f7068702d736f61702f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Dgame/php-soap/?branch=master)[![Build Status](https://camo.githubusercontent.com/70928a37a30185ed8783fce9f5896b7e7013bb623b912de9bccbf9567bf7b5bb/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4467616d652f7068702d736f61702f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Dgame/php-soap/build-status/master)[![StyleCI](https://camo.githubusercontent.com/85f79fc2a35cc3a3ee0516ccd1fd1d2cce1db138ef8472f78e28817a66cbd9cf/68747470733a2f2f7374796c6563692e696f2f7265706f732f36353638393534312f736869656c643f6272616e63683d6d6173746572)](https://styleci.io/repos/65689541)[![Build Status](https://camo.githubusercontent.com/28cacc19a031ea46829caf5134c99b6518d0e18615e15b6d38bb1bf2c4cd8a55/68747470733a2f2f7472617669732d63692e6f72672f4467616d652f7068702d736f61702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Dgame/php-soap)

Hydrate XML-Documents to objects or build XML from objects.

Hydration
=========

[](#hydration)

To hydrate XML files, you just simply have to write corresponding objects with appropriate properties / methods. Let's consider this xml file as an example:

```

        9
        Hamburg

            Hauptstraße 1
            245698

        Xperia Z3
        München

            Partkstraße
            365494

```

To hydrate it, you need a `Root` or `Envelope` class, a `Person` class, a `Car` class, a `Phone` class and an `Address` class. To find these objects, they should be named like the XML-Tags or you simply register them on the *ClassMapper*. To put the data into the objects, the methods should be named like the XML-Tag where the data comes from, prefixed with `set` or `append`. For example, to put the name into the person, these three variants are tried to fill the object:

- Use a public property with name `name`
- Use a public method: `setName`
- Use a public method: `appendName`

This is accomplished with the [php-object](https://github.com/Dgame/php-object) package.

But let's see the whole example of the hydration process:

```
$doc = new DOMDocument();
$doc->loadXML(...);

$mapper = new ClassMapper(
    [
        'Root'    => TestRoot::class,
        'Person'  => TestPerson::class,
        'Car'     => TestCar::class,
        'Phone'   => TestPhone::class,
        'Address' => TestAddress::class
    ]
);
$mapper->appendPattern('/^(?:soap\-?)?env(?:elope)?/iS', 'Root');

$hydrator = new Hydrator($mapper);
$objects  = $hydrator->hydrateDocument($doc);
```

That's it. As you can see, with the line `$mapper->appendPattern('/^(?:soap\-?)?env(?:elope)?/iS', 'Root');` we apply a regex to match all variants of soap XML-Tags and determine that the `Root` class should be used. And now we can test the result:

```
$this->assertCount(1, $objects);

/** @var TestRoot $root */
$root = $objects[0];

$this->assertNotNull($root);
$this->assertInstanceOf(TestRoot::class, $root);

$persons = $root->getPersons();
$this->assertCount(2, $persons);

$this->assertInstanceOf(TestPerson::class, $persons[0]);
$this->assertEquals('Max Musterman', $persons[0]->getName());
$this->assertInstanceOf(TestCar::class, $persons[0]->getCar());
$this->assertEquals('BMW', $persons[0]->getCar()->getMarke());
$this->assertNotEmpty($persons[0]->getCar()->kennung);
$this->assertEquals('i8', $persons[0]->getCar()->kennung);
$this->assertInstanceOf(TestPhone::class, $persons[0]->getPhone());
$this->assertEquals('iPhone', $persons[0]->getPhone()->getName());
$this->assertEquals(9, $persons[0]->getPhone()->getValue());
$this->assertEquals('Hamburg', $persons[0]->getBirthplace());
$this->assertInstanceOf(TestAddress::class, $persons[0]->getAddress());
$this->assertEquals('Hauptstraße 1', $persons[0]->getAddress()->getStreet());
$this->assertEquals(245698, $persons[0]->getAddress()->getPlz());

$this->assertInstanceOf(TestPerson::class, $persons[1]);
$this->assertEquals('Dr. Dolittle', $persons[1]->getName());
$this->assertInstanceOf(TestCar::class, $persons[1]->getCar());
$this->assertEquals('Audi', $persons[1]->getCar()->getMarke());
$this->assertNotEmpty($persons[0]->getCar()->kennung);
$this->assertEquals('A3', $persons[1]->getCar()->kennung);
$this->assertInstanceOf(TestPhone::class, $persons[1]->getPhone());
$this->assertEquals('Sony', $persons[1]->getPhone()->getName());
$this->assertEquals('Xperia Z3', $persons[1]->getPhone()->getValue());
$this->assertEquals('München', $persons[1]->getBirthplace());
$this->assertInstanceOf(TestAddress::class, $persons[1]->getAddress());
$this->assertEquals('Partkstraße', $persons[1]->getAddress()->getStreet());
$this->assertEquals(365494, $persons[1]->getAddress()->getPlz());
```

Pretty simple, isn't it?

Dehydration
===========

[](#dehydration)

Of course you can dehydrate/(re)assemble hydrated elements:

```
$doc2 = $hydrator->assemble($root);

$this->assertEqualXMLStructure($doc->documentElement, $doc2->documentElement);
```

That's all you need.

Creation
========

[](#creation)

And ultimately you can also create XML from your existing objects. Therefore, the following example shows four different BiPRO-Request:

### RequestTokenService

[](#requesttokenservice)

```
$envelope = new Envelope();

$security = new Security();
$token    = new UsernameToken('Foo', 'Bar');
$security->appendElement($token);

$header = new Header();
$header->appendElement($security);

$rst = new RequestSecurityToken();
$rst->appendElement(new BiPROVersion('2.1.6.1.1'));

$body = new Body();
$body->appendElement($rst);

$envelope->appendElement($header);
$envelope->appendElement($body);

$assembler = new Assembler();
$envelope->accept($assembler);

print $assembler->getDocument()->saveXML();
```

results in

```

        Foo
        Bar

      http://schemas.xmlsoap.org/ws/2005/02/sc/sct
      http://schemas.xmlsoap.org/ws/2005/02/trust/Issue
      2.1.6.1.1

```

### ListShipments

[](#listshipments)

```
$envelope = new Envelope();

$security = new Security();
$token    = new SecurityContextToken('bipro:7860072500822840554');
$security->appendElement($token);

$header = new Header();
$header->appendElement($security);

$request = new Request(new BiPROVersion('2.1.4.1.1'));
$request->setConfirm(false);
$shipment = new ListShipments($request);

$body = new Body();
$body->appendElement($shipment);

$envelope->appendElement($header);
$envelope->appendElement($body);

$assembler = new Assembler();
$envelope->accept($assembler);

print $assembler->getDocument()->saveXML();
```

results in

```

        bipro:7860072500822840554

        2.1.4.1.1
        false

```

### GetShipment

[](#getshipment)

```
$envelope = new Envelope();

$security = new Security();
$token    = new SecurityContextToken('bipro:7860072500822840554');
$security->appendElement($token);

$header = new Header();
$header->appendElement($security);

$request = new Request(new BiPROVersion('2.1.4.1.1'));
$request->setConsumerId(1);
$request->setId(1);
$request->setConfirm(false);
$shipment = new GetShipment($request);

$body = new Body();
$body->appendElement($shipment);

$envelope->appendElement($header);
$envelope->appendElement($body);

$assembler = new Assembler();
$envelope->accept($assembler);

print $assembler->getDocument()->saveXML();
```

results in

```

        bipro:7860072500822840554

        2.1.4.1.1
        1
        1
        false

```

AcknowledgeShipment
-------------------

[](#acknowledgeshipment)

```
$envelope = new Envelope();

$security = new Security();
$token    = new SecurityContextToken('bipro:7860072500822840554');
$security->appendElement($token);

$header = new Header();
$header->appendElement($security);

$request = new Request(new BiPROVersion('2.1.4.1.1'));
$request->setConsumerId(1);
$request->setId(1);
$shipment = new AcknowledgeShipment($request);

$body = new Body();
$body->appendElement($shipment);

$envelope->appendElement($header);
$envelope->appendElement($body);

$assembler = new Assembler();
$envelope->accept($assembler);

print $assembler->getDocument()->saveXML();
```

results in

```

                bipro:7860072500822840554

                2.1.4.1.1
                1
                1

```

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity32

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 98.9% 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 ~33 days

Recently: every ~75 days

Total

14

Last Release

2979d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2a9fa98c1a3e70a521430fc2fba266657b2c981b5d8a36bf236fad01f9846dcd?d=identicon)[Dgame](/maintainers/Dgame)

---

Top Contributors

[![Dgame](https://avatars.githubusercontent.com/u/2406877?v=4)](https://github.com/Dgame "Dgame (90 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (1 commits)")

---

Tags

biprophpsoapxmlsoapBipro

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[masterminds/html5

An HTML5 parser and serializer.

1.8k242.8M229](/packages/masterminds-html5)[jms/serializer

Library for (de-)serializing data of any complexity; supports XML, and JSON.

2.3k135.8M851](/packages/jms-serializer)[jms/metadata

Class/method/property metadata management in PHP

1.8k152.8M88](/packages/jms-metadata)[jms/serializer-bundle

Allows you to easily serialize, and deserialize data of any complexity

1.8k89.3M627](/packages/jms-serializer-bundle)[sabre/xml

sabre/xml is an XML library that you may not hate.

52832.2M131](/packages/sabre-xml)[amabnl/amadeus-ws-client

SOAP Web Service client library for interacting with the Amadeus GDS through its SOAP interface

204248.5k](/packages/amabnl-amadeus-ws-client)

PHPackages © 2026

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