Download the PHP package dgame/php-soap without Composer
On this page you can find all versions of the php package dgame/php-soap. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download dgame/php-soap
More information about dgame/php-soap
Files in dgame/php-soap
Package php-soap
Short Description php soap
License MIT
Homepage https://github.com/php-soap
Informations about the package php-soap
php-soap
Hydrate XML-Documents to objects or build XML from objects.
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:
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 package.
But let's see the whole example of the hydration process:
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:
Pretty simple, isn't it?
Dehydration
Of course you can dehydrate/(re)assemble hydrated elements:
That's all you need.
Creation
And ultimately you can also create XML from your existing objects. Therefore, the following example shows four different BiPRO-Request:
RequestTokenService
results in
ListShipments
results in
GetShipment
results in
AcknowledgeShipment
results in
All versions of php-soap with dependencies
dgame/php-object Version >=0.4.0
dgame/php-iterator Version >=0.3.0
monolog/monolog Version ^1.22