jeremylivingston / exfoliate
A lightweight PHP SOAP wrapper
Installs: 41 219
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 2
Open Issues: 0
Requires
- php: >=5.3.3
Requires (Dev)
- jeremylivingston/core-proxies: dev-master
- phpunit/phpunit: >=3.7
This package is not auto-updated.
Last update: 2024-11-18 15:03:21 UTC
README
Exfoliate is a lightweight PHP wrapper for the core SoapClient class.
This library exists to make interactions with SOAP-based web services less painful. Exfoliate wraps SOAP exceptions in logical event-based exception classes.
The Exfoliate SoapClient is capable being constructed without initializing a connection to the web service. This capability can improve performance and also improve the handling of connection exceptions.
Installation
The suggested installation method is via composer:
php composer.phar require jeremylivingston/exfoliate:dev-master
After installing the Exfoliate library, simply create a new instance of the client and call any web service methods you desire:
<?php use Exfoliate\SoapClient; $client = new SoapClient('my-service-url', array('trace' => true)); $response = $client->call('GetUser', array('user_id' => 1234));
Use the Exfoliate\SoapClient::setHeaders()
method to set any SOAP headers when the client is initialized:
<?php use Exfoliate\SoapClient; $client = new SoapClient('my-service-url', array('trace' => true)); $client->setHeaders( new \SoapHeader('my-namespace', 'Auth', array('User' => 'me', 'Password' => 'pw')) ); $response = $client->call('GetUser', array('user_id' => 1234));
You can retrieve the most recent request and response content via the Exfoliate\SoapClient::getLastRequest()
and
Exfoliate\SoapClient::getLastResponse()
methods, respectively:
<?php use Exfoliate\SoapClient; $client = new SoapClient('my-service-url', array('trace' => true)); $response = $client->call('GetUser', array('user_id' => 1234)); $lastRequest = $client->getLastRequest(); $lastResponse = $client->getLastResponse();