PHPackages                             dhcmediway/wsdl2phpgenerator - 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. dhcmediway/wsdl2phpgenerator

ActiveLibrary[API Development](/categories/api)

dhcmediway/wsdl2phpgenerator
============================

Simple class library for generating php classes from a wsdl file.

3.5.10(3y ago)15.4k↓27.8%MITPHPPHP &gt;=7.1

Since Oct 26Pushed 3y agoCompare

[ Source](https://github.com/DHCMediWay/wsdl2phpgenerator)[ Packagist](https://packagist.org/packages/dhcmediway/wsdl2phpgenerator)[ RSS](/packages/dhcmediway-wsdl2phpgenerator/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (10)Dependencies (2)Versions (49)Used By (0)

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

[](#installation)

Add wsdl2phpgenerator to your [Composer](https://getcomposer.org/doc/00-intro.md) project:

```
composer require dhcmediway/wsdl2phpgenerator
```

The project will also be available as [a command line application](https://github.com/wsdl2phpgenerator/wsdl2phpgenerator-cli) which can be downloaded as a phar file.

Usage
-----

[](#usage)

To generate classes create a `Generator` instance and pass it a `Config` instance.

```
$generator = new \Wsdl2PhpGenerator\Generator();
$generator->generate(
	new \Wsdl2PhpGenerator\Config(array(
        'inputFile' => 'input.wsdl',
        'outputDir' => '/tmp/output'
    ))
);
```

After generating the code then configure your existing autoloader accordingly. The generated code also comes with a simple `autoload.php` file which can be included directly. This registers a simple autoloader for the generated classes.

#### Example usage

[](#example-usage)

The following example will generate code from a web service, load the generated classes, call the web service and return the result over the course of a single process.

```
$generator = new \Wsdl2PhpGenerator\Generator();
$generator->generate(
	new \Wsdl2PhpGenerator\Config(array(
        'inputFile' => 'http://www.webservicex.net/CurrencyConvertor.asmx?WSDL',
        'outputDir' => '/tmp/CurrencyConverter'
    ))
);

require '/tmp/CurrencyConverter/autoload.php';

// A class will generated representing the service.
// It is named after the element in the WSDL and has a method for each operation.
$service = new \CurrencyConvertor();
$request = new \ConversionRate(\Currency::USD, \Currency::EUR);
$response = $service->ConversionRate($request);

echo $response->getConversionRateResult();
```

Note that this is not recommended usage. Normally code generation and web services calls will be two separate processes.

### Options

[](#options)

The generator supports a range of options which can be set in the configuration.

#### `inputFile`

[](#inputfile)

The path or url to the WSDL to generate classes from.

#### `outputDir`

[](#outputdir)

The directory to place the generated classes in. It will be created if it does not already exist.

#### `namespaceName`

[](#namespacename)

The [namespace](http://php.net/manual/en/language.namespaces.php) to use for the generated classes. If not set classes will be generated without a namespace.

##### Example usage

[](#example-usage-1)

The following configuration will place generated code from the [CDYNE Weather web service](http://wiki.cdyne.com/?title=CDYNE_Weather) under the `CDyne\Weather` namespace:

```
$generator = new \Wsdl2PhpGenerator\Generator();
$generator->generate(
    new \Wsdl2PhpGenerator\Config(array(
        'inputFile' => 'http://wsf.cdyne.com/WeatherWS/Weather.asmx?wsdl',
        'outputDir' => '/tmp/weather',
        'namespaceName' => 'CDyne\Weather'
    ))
);
```

#### `classNames`

[](#classnames)

A comma-separared list or array of class names to generate. All other classes in the WSDL will be ignored.

This option is deprecated and will be removed in 4.0.0. Use `operationNames` instead.

##### Example usage

[](#example-usage-2)

The following configuration will only generate `AmazonEC2` and `CopyImageType` classes from the Amazon EC2 webservice.

```
$generator = new \Wsdl2PhpGenerator\Generator();
$generator->generate(
    new \Wsdl2PhpGenerator\Config(array(
        'inputFile' => 'https://s3.amazonaws.com/ec2-downloads/2013-10-01.ec2.wsdl',
        'outputDir' => '/tmp/amazon',
        'classNames' => 'AmazonEC2, CopyImageType'
    ))
);
```

#### `operationNames`

[](#operationnames)

A comma-separated list or array of service operations to generate. This will only generate types that are needed for selected operations. The generated service class will only contain selected operation.

##### Example usage

[](#example-usage-3)

The following configuration will generate operations and types for `ReplaceRouteTableAssociation` and `RequestSpotInstances` operations.

```
$generator = new \Wsdl2PhpGenerator\Generator();
$generator->generate(
    new \Wsdl2PhpGenerator\Config(array(
        'inputFile' => 'https://s3.amazonaws.com/ec2-downloads/2013-10-01.ec2.wsdl',
        'outputDir' => '/tmp/amazon',
        'operationNames' => 'ReplaceRouteTableAssociation, RequestSpotInstances'
    ))
);
```

#### `sharedTypes`

[](#sharedtypes)

If enabled this makes all types with the same identify use the same class and only generate it once. The default solution is to prepend numbering to avoid name clashes.

#### `constructorParamsDefaultToNull`

[](#constructorparamsdefaulttonull)

If enabled this sets the default value of all parameters in all constructors to `null`. If this is used then properties must be set using accessors.

#### `proxy`

[](#proxy)

Specify a proxy to use when accessing the WSDL and other external ressources. This option should be used instead of \[the proxy options support by the PHP `SoapClient`\] () as wsdl2phpgenerator uses more than the SOAP client to extract information.

The following formats are supported:

- An array with the following keys `host`, `port`, `login` and `password` matching \[the proxy options support by the PHP `SoapClient`\] ()
- A string in an URL-like format

The proxy information is used by is used when accessing the WSDL to generate the code and for subsequent requests to the SOAP service.

##### Example usage

[](#example-usage-4)

The following configuration will use a proxy to access the [Google DoubleClick Ad Exchange Buyer SOAP API](https://developers.google.com/ad-exchange/buyer-soap/):

```
$generator = new \Wsdl2PhpGenerator\Generator();
$generator->generate(
    new \Wsdl2PhpGenerator\Config(array(
        'inputFile' => 'https://ads.google.com/apis/ads/publisher/v201306/ActivityService?wsdl',
        'outputDir' => '/tmp/amazon',
        'proxy' => 'tcp://user:secret@192.168.0.1:8080'
    ))
);
```

#### `soapClientClass`

[](#soapclientclass)

The base class to use for generated services. This should be a subclass of the [PHP `SoapClient`](http://php.net/manual/en/class.soapclient.php).

Examples of third party SOAP client implementations which can be used:

- [BeSimpleSoapClient](https://github.com/BeSimple/BeSimpleSoapClient)
- [ZendFramework2 SOAP Component](https://github.com/zendframework/Component_ZendSoap)
- [soap-plus](https://github.com/dcarbone/soap-plus)
- [SoapClientEx](https://gist.github.com/RobThree/4117914)

Note that it is the responsibility of the surrounding code to ensure that the base class is available during code generation and when calling web services.

##### Example usage

[](#example-usage-5)

The following configuration will use the BeSimple SOAP client as base class:

```
$generator = new \Wsdl2PhpGenerator\Generator();
$generator->generate(
    new \Wsdl2PhpGenerator\Config(array(
        'inputFile' => 'input.wsdl',
        'outputDir' => '/tmp/output',
        'soapClientClass' => '\BeSimple\SoapClient\SoapClient'
    ))
);
```

#### `soapClientOptions`

[](#soapclientoptions)

An array of configuration options to pass to the SoapClient. They will be used when accessing the WSDL to generate the code and as defaults for subsequent requests to the SOAP service. The PHP documentation has [a list of supported options](http://php.net/manual/en/soapclient.soapclient.php#refsect1-soapclient.soapclient-parameters).

The list of options for the client can be extended by using more advanced `SoapClient` implementations.

Note that wsdl2phpgenerator expects the `features` option to contain `SOAP_SINGLE_ELEMENT_ARRAYS`. [This ensures that type hints are consistent even if sequences only contain one element](http://php.net/manual/en/soapclient.soapclient.php#73082). If the `features` option is set explicitly in `soapClientOptions` the `SOAP_SINGLE_ELEMENT_ARRAYS` must also be added explicitly.

##### Example usage

[](#example-usage-6)

The following configuration will enable basic authentication and set the connection timeout to 60 seconds.

```
$generator = new \Wsdl2PhpGenerator\Generator();
$generator->generate(
    new \Wsdl2PhpGenerator\Config(array(
        'inputFile' => 'input.wsdl',
        'outputDir' => '/tmp/output',
        'soapClientOptions' => array(
        	'authentication' => SOAP_AUTHENTICATION_BASIC,
        	'login' => 'username',
        	'password' => 'secret',
        	'connection_timeout' => 60
    ))
));
```

Versioning
----------

[](#versioning)

This project aims to use [semantic versioning](http://semver.org/). The following constitutes the public API:

- `\Wsdl2PhpGenerator\GeneratorInterface`
- `\Wsdl2PhpGenerator\ConfigInterface`
- Generated code

Backwards incompatible changes to these means that the major version will be increased. Additional features and bug fixes increate minor and patch versions.

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 71.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 ~74 days

Recently: every ~397 days

Total

47

Last Release

1223d ago

Major Versions

2.5.5 → 3.0.02014-11-25

PHP version history (2 changes)2.0.0PHP &gt;=5.3.0

3.5.9PHP &gt;=7.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/38342775?v=4)[DHCMediWay](/maintainers/DHCMediWay)[@DHCMediWay](https://github.com/DHCMediWay)

---

Top Contributors

[![kasperg](https://avatars.githubusercontent.com/u/73966?v=4)](https://github.com/kasperg "kasperg (320 commits)")[![walle](https://avatars.githubusercontent.com/u/191136?v=4)](https://github.com/walle "walle (33 commits)")[![DHCMediWay](https://avatars.githubusercontent.com/u/38342775?v=4)](https://github.com/DHCMediWay "DHCMediWay (31 commits)")[![honzap](https://avatars.githubusercontent.com/u/342109?v=4)](https://github.com/honzap "honzap (10 commits)")[![red-led](https://avatars.githubusercontent.com/u/1540305?v=4)](https://github.com/red-led "red-led (7 commits)")[![liuende501](https://avatars.githubusercontent.com/u/20351739?v=4)](https://github.com/liuende501 "liuende501 (5 commits)")[![chriskl](https://avatars.githubusercontent.com/u/1606651?v=4)](https://github.com/chriskl "chriskl (4 commits)")[![garex](https://avatars.githubusercontent.com/u/77981?v=4)](https://github.com/garex "garex (3 commits)")[![jabiinfante](https://avatars.githubusercontent.com/u/2393956?v=4)](https://github.com/jabiinfante "jabiinfante (3 commits)")[![statik-olmo-archived](https://avatars.githubusercontent.com/u/1501928?v=4)](https://github.com/statik-olmo-archived "statik-olmo-archived (3 commits)")[![ivol84](https://avatars.githubusercontent.com/u/1837943?v=4)](https://github.com/ivol84 "ivol84 (3 commits)")[![ecolinet](https://avatars.githubusercontent.com/u/65506?v=4)](https://github.com/ecolinet "ecolinet (2 commits)")[![lafriks](https://avatars.githubusercontent.com/u/165205?v=4)](https://github.com/lafriks "lafriks (2 commits)")[![RSully](https://avatars.githubusercontent.com/u/185004?v=4)](https://github.com/RSully "RSully (2 commits)")[![SamMousa](https://avatars.githubusercontent.com/u/547021?v=4)](https://github.com/SamMousa "SamMousa (2 commits)")[![fduch](https://avatars.githubusercontent.com/u/1204137?v=4)](https://github.com/fduch "fduch (1 commits)")[![lunetics](https://avatars.githubusercontent.com/u/149752?v=4)](https://github.com/lunetics "lunetics (1 commits)")[![methodin](https://avatars.githubusercontent.com/u/231557?v=4)](https://github.com/methodin "methodin (1 commits)")[![nuth](https://avatars.githubusercontent.com/u/1124895?v=4)](https://github.com/nuth "nuth (1 commits)")[![jongotlin](https://avatars.githubusercontent.com/u/165154?v=4)](https://github.com/jongotlin "jongotlin (1 commits)")

---

Tags

soapwsdl

### Embed Badge

![Health badge](/badges/dhcmediway-wsdl2phpgenerator/health.svg)

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

###  Alternatives

[sylius/sylius

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

8.5k5.9M737](/packages/sylius-sylius)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k38.9k](/packages/matomo-matomo)[piotrooo/wsdl-creator

PHP WSDL creator using PHPdoc (annotations, reflections).

86163.0k2](/packages/piotrooo-wsdl-creator)[camcima/camcima-soap-client

Wrapper around PHP SoapClient class

2772.6k2](/packages/camcima-camcima-soap-client)[conquer/services

Yii2 soap wsdl web services

1734.3k](/packages/conquer-services)[skautis/skautis

Library for API calls to SkautIS

1433.6k4](/packages/skautis-skautis)

PHPackages © 2026

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