Skip to content
Mikaël DELSOL edited this page Feb 22, 2022 · 60 revisions

Available options

When a command line option name is indicated such as composer-name, you should be aware that it has to be prefixed with --:

$ wsdltophp --composer-name="my/sdk"

Required options

WSDL URL or path

This is the absolute url or the absolute/relative path from which the WSDL has to be loaded.

  • Command line option name: urlorpath
  • Methods names:
    • $options->setOrigin(string $origin)
    • $generator->setOptionOrigin(string $origin)

Destination

This is the absolute/relative path where the package has to be generated into.

  • Command line option name: destination
  • Methods names:
    • $options->setDestination(string $destination)
    • $generator->setOptionDestination(string $destination)

Composer name

This option is required in order to generate the composer.json file with a valid composer name. If you do not want to provide a composer name then you MUST set the option standalone to false.

  • Command line option name: composer-name
  • Methods names:
    • $options->setComposerName(string $composerName)
    • $generator->setOptionComposerName(string $composerName)

Force

/!\ Command line only /!\

Without this option, the generator will display all the options that are going to be used to generate your package.

Command line option name: force

The output without this option is such as below:

 Start at 2016-11-30 01:15:12
  Generation not launched, use "--force" option to force generation
  Generator's option file used: /path/to/your/configuration/file.yml
  Used generator's options:
    category: "cat"
    gather_methods: "start"
    generic_constants_names: false
    generate_tutorial_file: true
    add_comments: {"date":"2015-04-22","author":"Me","release":"1.1.0","team":"Dream"}
    namespace_prefix: "My\\Project"
    standalone: true
    validation: true
    struct_class: "\\Std\\Opt\\StructClass"
    struct_array_class: "\\Std\\Opt\\StructArrayClass"
    soap_client_class: "\\Std\\Opt\\SoapClientClass"
    origin: "http:\/\/developer.ebay.com\/webservices\/latest\/ebaySvc.wsdl"
    destination: "\/var\/www\/Api\/"
    src_dirname: "SoapClient"
    prefix: "Api"
    suffix: "Project"
    basic_login: "*******"
    basic_password: "*******"
    proxy_host: "****************************"
    proxy_port: "*******"
    proxy_login: "*******"
    proxy_password: "*******"
    soap_options: []
    composer_name: "wsdltophp\/package"
    composer_settings: {"config":{"disable-tls":true},"require":{"wsdltophp\/wssecurity":"dev-master"}}
    structs_folder: "Structs"
    arrays_folder: "Arrays"
    enums_folder: "Enums"
    services_folder: "Services"
 End at 2016-11-30 01:15:12, duration: 00:00:00

Class naming

Prefix

If you wish to prefix all the generated classes, you can pass the string you want and it will be used to prefix every generated class as it is.

  • Command line option name: prefix
  • Methods names:
    • $options->setPrefix(string $prefix)
    • $generator->setOptionPrefix(string $prefix)

Suffix

If you wish to suffix all the generated classes, you can pass the string you want and it will be used to suffix every generated class as it is.

  • Command line option name: suffix
  • Methods names:
    • $options->setSuffix(string $suffix)
    • $generator->setOptionSuffix(string $suffix)

Basic authentication

These two options are useful only when the WSDL is protected by a Basic HTTP Authentication.

Login

The login that has been provided to you.

  • Command line option name: login
  • Methods names:
    • $options->setBasicLogin(string $login)
    • $generator->setOptionBasicLogin(string $login)

Password

The password that has been provided to you.

  • Command line option name: password
  • Methods names:
    • $options->setBasicPassword(string $password)
    • $generator->setOptionBasicPassword(string $password)

Proxy settings

These options are useful only when you're behind a proxy.

Proxy host

Your proxy host.

  • Command line option name: proxy-host
  • Methods names:
    • $options->setProxyHost(string $host)
    • $generator->setOptionProxyHost(string $host)

Proxy port

Your proxy port (often 3128).

  • Command line option name: proxy-port
  • Methods names:
    • $options->setProxyPort(string $port)
    • $generator->setOptionProxyPort(string $port)

Proxy login

Your proxy login if any.

  • Command line option name: proxy-login
  • Methods names:
    • $options->setProxyLogin(string $login)
    • $generator->setOptionProxyLogin(string $login)

Proxy password

Your proxy password if any.

  • Command line option name: proxy-password
  • Methods names:
    • $options->setProxyPassword(string $password)
    • $generator->setOptionProxyPassword(string $password)

Directories structure

By default, the generated package looks like this:

|-- src
|   |-- ArrayType: classes that contain one property which is an array of items
|   |-- EnumType: classes that only contain constants, enumerations
|   |-- ServiceType: classes that map to the operations
|   |-- StructType: any type that represents a request/response parameter
|   `-- ClassMap.php: the class that defines the mapping used by the SoapClient class
|-- vendor
|   |-- bin
|   |-- composer
|   |-- wsdltophp
|   `-- autoload.php
|-- composer.json
|-- composer.lock
|-- tutorial.php

Every level of this directory structure can be modified using options.

Src dirname

This option defines the name of the root directory src.

If you do not want the src directory in order to have its children directories at the root level, then pass an empty string.

If you want to rename the src directory, then pass the string you want.

  • Command line option name: src-dirname
    • set this option to "/" if you wish to remove the src directory level
  • Methods names:
    • $options->setSrcDirname(string $name)
    • $generator->setOptionSrcDirname(string $name)

Category

This option is an old option that allows to switch between 2 modes:

  • generate all the classes under their type directory (value = cat or GeneratorOptions::VALUE_CAT)
  • generate all the classes at the same level (value = none or GeneratorOptions::VALUE_NONE)

By default, the value of this option is set to cat.

  • Command line option name: category
  • Methods names:
    • $options->setCategory(string $category)
    • $generator->setOptionCategory(string $category)

Structs folder

The Structs are all the classes that map the structs declared in the WSDL/schema of your SOAP Web Service. They contain properties you set to send a request. They also contain all the properties you receive from a response. These classes names are passed to the SoapClient class in order to have full automatic mapping of your parameters and responses.

By default, these classes are generated under the StructType folder (which is used as namespace too).

  • Command line option name: structs-folder
  • Methods names:
    • $options->setStructsFolder(string $folder)
    • $generator->setOptionStructsFolder(string $folder)

Arrays folder

The Arrays are all the classes that map the structs that contain only one property which is an array of any type of value declared in the WSDL/schema of your SOAP Web Service. They are used both in the request and the response. These classes names are passed to the SoapClient class in order to have full automatic mapping of your parameters and responses.

By default, these classes are generated under the ArrayType folder (which is used as namespace too).

  • Command line option name: arrays-folder
  • Methods names:
    • $options->setArraysFolder(string $folder)
    • $generator->setOptionArraysFolder(string $folder)

Enums folder

The Enums are all the classes that contain the enumerations values declared in the WSDL/schema of your SOAP Web Service as constants. They are used to help you define the value awaited by a property of Struct class.

By default, these classes are generated under the EnumType folder (which is used as namespace too).

  • Command line option name: enums-folder
  • Methods names:
    • $options->setEnumsFolder(string $folder)
    • $generator->setOptionEnumsFolder(string $folder)

Services folder

The Services are all the classes that contain operations declared in the WSDL/schema of your SOAP Web Service. Operations are gathered using the beginning or the ending of the operation's name (see Gather operations methods option).

By default, these classes are generated under the ServiceType folder (which is used as namespace too).

  • Command line option name: services-folder
  • Methods names:
    • $options->setServicesFolder(string $folder)
    • $generator->setOptionServicesFolder(string $folder)

Namespace directories

As of v4.*, the classes are generated under the namespace path structure (ex: My\Generated\Package will generate a directory as My/Generated/Package), if the namespace option is defined. This can be problematic if you used the v3 version. You can keep the previous behaviour using this option passing false as value.

  • Command line option name: namespace-directories
  • Methods names:
    • $options->setNamespaceDictatesDirectories(bool $namespaceDictatesDirectories)
    • $generator->setOptionNamespaceDictatesDirectories(bool $namespaceDictatesDirectories)

Classes inheritance

The generated Struct, Array and Service classes all inherit from base classes which are defined by the PackageBase project. This inheritance is used to ensure the homogeneity of these classes. In addition, they provide additional useful base behaviors.

Struct

By default, Struct classes inherit from the \WsdlToPhp\PackageBase\AbstractStructBase class. If you wish to implement your own base class, please read this section first then provide the fully qualified name of your class to the option.

  • Command line option name: struct
  • Methods names:
    • $options->setStructClass(string $class)
    • $generator->setOptionStructClass(string $class)

StructArray

By default, Struct array classes inherit from the \WsdlToPhp\PackageBase\AbstractStructArrayBase class. If you wish to implement your own base class, please read this section first then provide the fully qualified name of your class to the option.

  • Command line option name: structarray
  • Methods names:
    • $options->setStructArrayClass(string $class)
    • $generator->setOptionStructArrayClass(string $class)

StructEnum

By default, Struct enum classes inherit from the \WsdlToPhp\PackageBase\AbstractStructEnumBase class. If you wish to implement your own base class, please read this section first then provide the fully qualified name of your class to the option.

  • Command line option name: structenum
  • Methods names:
    • $options->setStructEnumClass(string $class)
    • $generator->setOptionStructEnumClass(string $class)

SoapClient

By default, Service classes inherit from the \WsdlToPhp\PackageBase\AbstractSoapClientBase class. If you wish to implement your own base class, please read this section first then provide the fully-qualified name of your class to the option. This is basically a decorator pattern.

Just to understand when this option is useful, imagine you have a SOAP Web Service which does not handle certain XML tags added by the native PHP SoapClient class. Overriding the native PHP SoapClient class is possible so this option gives you the possibility to do so. In addition to providing you a way to implement generic methods for every Service class, it also provides you a way to use your own SoapClient class implementation. The best way to understand how it works is to take a look to the PackageEws365 project that uses this feature with a custom SoapClient base class (from which every Service class inherit) and a custom SoapClient class (that inherits from the native PHP SoapClient class) in order to remove empty XML tags present in the XML request.

  • Command line option name: soapclient
  • Methods names:
    • $options->setSoapClientClass(string $class)
    • $generator->setOptionSoapClientClass(string $class)

Miscellaneous

Standalone

This option allows you to generate the package with two different perspectives:

  • standalone (default mode): this means the package is generated as an independent project with its own composer.json file. At the end of the generation, the root directory where the package has been generated will contain the composer.json, the composer.lock file and the vendor directory. So you can create a php file, add require_once __DIR__ . '/vendor/autoload.php';, then start using the generated classes.
  • not standalone: this means the package is generated as part of an existing project using its own composer.json file. So if you specified the namespace option with Ews for example, you need to add something like "Ews\\": "/destination_option_value/src/", in the autoload > psr-4 section of your existing composer.json file. In addition, the generated classes inherit (by default) from the PackageBase project classes, so you have to require the wsdltophp/packagebase project unless you used your own classes using one or more options from the classes inheritance section.

To conclude, knowing this you certainly now know if you need to enable the standalone mode or not.

  • Command line option name: standalone
  • Methods names:
    • $options->setStandalone(bool $standalone)
    • $generator->setOptionStandalone(bool $standalone)

Namespace

This option is useful in several cases:

  • The operations/structs uses a reserved PHP keyword or function name, this allows to avoid the class name or the method name to be replaced by a safe name,
  • You want to generate the package into an existing namespace of yours without having to edit your composer.json,
  • You simply can't stand classes without a namespace,
  • Etc.

To conclude, you can specify the namespace with a value like Ews or Package\Ews.

  • Command line option name: namespace
  • Methods names:
    • $options->setNamespace(string $namespace)
    • $generator->setOptionNamespace(string $namespace)

Classes comments

Classes comments allows to add annotations with a value or simply a comment into every generated classes' PHP Doc block of the file.

Suppose you generate the package dynamically and you want to know when the package has been generated, with which version of your code it has been generated and you want to add your own description, you can add @date and @codeVersion annotations with your own value such as:

  • Command line usage :
$ wsdltophp --addcomments="date:2017/06/21" \
            --addcomments="codeVersion:1.3.2" \
            --addcomments="This has been generated from server 01"
  • Methods usage:
/* @var GeneratorOptions $options */
$options->setAddComments([
    "date" => date("Y/m/d"),
    "codeVersion" => "1.3.2",
    "This has been generated from server 01",
]);

/* @var Generator $generator */
$generator->setOptionAddComments([
    "date" => date("Y-m-d"),
    "codeVersion" => "1.3.2",
    "This has been generated from server 01",
]);

This will generate a PHP Doc block such as:

/**
 * This class stands for Add ServiceType
 * @package Ews
 * @subpackage Services
 * @date 2017/06/21
 * @codeVersion 1.3.2
 * This has been generated from server 01
 */
  • Command line option name: addcomments
  • Methods names:
    • $options->setAddComments(array $comments)
    • $generator->setOptionAddComments(array $comments)

Constants naming

Constants classes are generated to represent enumerations defined in a WSDL/schema.

For example when the schema declares this:

<xs:simpleType name="ExchangeVersionType">
 <xs:restriction base="xs:string">
  <xs:enumeration value="Exchange2007" />
  <xs:enumeration value="Exchange2007_SP1" />
  <xs:enumeration value="Exchange2010" />
  <xs:enumeration value="Exchange2010_SP1" />
  <xs:enumeration value="Exchange2010_SP2" />
  <xs:enumeration value="Exchange2013" />
  <xs:enumeration value="Exchange2013_SP1" />
  <xs:enumeration value="Exchange2015" />
  <xs:enumeration value="V2_47" />
 </xs:restriction>
</xs:simpleType>

By default (value = false), you end up with a class like:

namespace Ews\EnumType;

class EwsExchangeVersionType
{
    /**
     * Constant for value 'Exchange2007'
     * @return string 'Exchange2007'
     */
    const VALUE_EXCHANGE_2007 = 'Exchange2007';
    /**
     * Constant for value 'Exchange2007_SP1'
     * @return string 'Exchange2007_SP1'
     */
    const VALUE_EXCHANGE_2007_SP_1 = 'Exchange2007_SP1';
    /**
     * Constant for value 'Exchange2010'
     * @return string 'Exchange2010'
     */
    const VALUE_EXCHANGE_2010 = 'Exchange2010';
    /**
     * Constant for value 'Exchange2010_SP1'
     * @return string 'Exchange2010_SP1'
     */
    const VALUE_EXCHANGE_2010_SP_1 = 'Exchange2010_SP1';
    /**
     * Constant for value 'Exchange2010_SP2'
     * @return string 'Exchange2010_SP2'
     */
    const VALUE_EXCHANGE_2010_SP_2 = 'Exchange2010_SP2';
    /**
     * Constant for value 'Exchange2013'
     * @return string 'Exchange2013'
     */
    const VALUE_EXCHANGE_2013 = 'Exchange2013';
    /**
     * Constant for value 'Exchange2013_SP1'
     * @return string 'Exchange2013_SP1'
     */
    const VALUE_EXCHANGE_2013_SP_1 = 'Exchange2013_SP1';
    /**
     * Constant for value 'Exchange2015'
     * @return string 'Exchange2015'
     */
    const VALUE_EXCHANGE_2015 = 'Exchange2015';
    /**
     * Constant for value 'V2_47'
     * @return string 'V2_47'
     */
    const VALUE_V_2_47 = 'V2_47';
    ...

But you can decide to end up with this class:

namespace Ews\EnumType;

class EwsExchangeVersionType
{
    /**
     * Constant for value 'Exchange2007'
     * @return string 'Exchange2007'
     */
    const ENUM_VALUE_1 = 'Exchange2007';
    /**
     * Constant for value 'Exchange2007_SP1'
     * @return string 'Exchange2007_SP1'
     */
    const ENUM_VALUE_2 = 'Exchange2007_SP1';
    /**
     * Constant for value 'Exchange2010'
     * @return string 'Exchange2010'
     */
    const ENUM_VALUE_3 = 'Exchange2010';
    /**
     * Constant for value 'Exchange2010_SP1'
     * @return string 'Exchange2010_SP1'
     */
    const ENUM_VALUE_4 = 'Exchange2010_SP1';
    /**
     * Constant for value 'Exchange2010_SP2'
     * @return string 'Exchange2010_SP2'
     */
    const ENUM_VALUE_5 = 'Exchange2010_SP2';
    /**
     * Constant for value 'Exchange2013'
     * @return string 'Exchange2013'
     */
    const ENUM_VALUE_6 = 'Exchange2013';
    /**
     * Constant for value 'Exchange2013_SP1'
     * @return string 'Exchange2013_SP1'
     */
    const ENUM_VALUE_7 = 'Exchange2013_SP1';
    /**
     * Constant for value 'Exchange2015'
     * @return string 'Exchange2015'
     */
    const ENUM_VALUE_7 = 'Exchange2015';
    /**
     * Constant for value 'V2_47'
     * @return string 'V2_47'
     */
    const ENUM_VALUE_8 = 'V2_47';
    ...
  • Command line option name: genericconstants
  • Methods names:
    • $options->setGenericConstantsName(bool $generic)
    • $generator->setOptionGenericConstantsName(bool $generic)

Composer settings

Composer settings option is useful when you generate a package with the standalone option set to true. In this case, the composer.json file is generated with default values and the composer update --verbose --optimize-autoloader --no-dev command is executed.

Imagine you need to disable tls (not safe) and you want to add the package wsdltophp/wssecurity:~1.0 into the require section (so it is fetched at the execution of the composer update command) of the generated composer.json file, you can do it this way:

  • Command line usage:
# take attention to the notation which is a sort of JSON notation such as path.to.the.section.key:value
$ wsdltophp --composer-settings="config.disable-tls:true" \
            --composer-settings="require.wsdltophp/wssecurity:~1.0"
  • Methods usage:
/* @var GeneratorOptions $options */
$options->setComposerSettings([
    "config.disable-tls:true",
    "require.wsdltophp/wssecurity:~1.0",
]);

/* @var Generator $generator */
// This is another way to pass the settings which can be passed to the $options->setComposerSettings() method too
$generator->setOptionComposerSettings([
    "config" => [
        "disable-tls" => true,
    ],
    "require" => [
        "wsdltophp/wssecurity" => "~1.0",
    ],
]);

This will generate this composer.json file (in part):

{
    "name": "wsdltophp/ews",
    "description": "Package generated from main.wsdl using wsdltophp/packagegenerator",
    "require": {
        "php": ">=5.3.3",
        "ext-soap": "*",
        "wsdltophp/packagebase": "~1.0",
        "wsdltophp/wssecurity": "~1.0"
    },
    "autoload": {
        "psr-4": {
            "": "./src/"
        }
    },
    "config": {
        "disable-tls": true
    }
}

To conclude, in most case you won't need it but it's here if you need.

  • Command line option name: composer-settings
  • Methods names:
    • $options->setComposerSettings(array $settings)
    • $generator->setOptionComposerSettings(array $settings)

Validation

By default (value = true), every generated setter in the Struct classes contains a sanity check as soon the value is not typed as another generated class. This means string, bool, float and int types are always checked when you pass a value. In addition, other validations are present to ensure that you pass the correct value according to the specification of the schema. The sanity check rules are defined in the File\Validation namespace and force values of type:

  • array of values: you MUST pass an array containing only values of the specified value type
  • bool/boolean: you MUST pass a boolean value
  • choice: you MUST pass only set one property among a set of properties
  • enumeration value: you MUST pass a value which is contained by a generated constants class for enumerations
  • float: you MUST pass a float value
  • fractionDigits: you MUST pass exactly a certain number of digits after the decimal symbol
  • int: you MUST pass a integer value
  • length: you MUST pass a string/number with the exact length
  • list: you MUST pass a certain list of values restricted by the value or the type
  • maxExclusive: you MUST pass a number or a date interval which is strictly inferior to the specified value
  • maxInclusive: you MUST pass a number or a date interval which is inferior or equal to the specified value
  • maxLength: you MUST pass a string/number which has a length strictly inferior to the specified value
  • maxOccurs: you MUST pass a number of item lower that the specified limit
  • minExclusive: you MUST pass a number or a date interval which is strictly superior to the specified value
  • minInclusive: you MUST pass a number or a date interval which is superior or equal to the specified value
  • minLength: you MUST pass a string/number which has a length strictly superior to the specified value
  • pattern: you MUST pass a string which match the specified regexp pattern
  • string: you MUST pass a string value
  • totalDigits: you MUST pass a number that contains at most the number of digits (negative, positive, decimal symbols are not taken into account) specified by the value
  • union: you MUST pass a value that matches at least one restriction among a set of restrictions
  • xml: you MUST pass a string XML string or a https://www.php.net/manual/en/class.domdocument.php

So if you pass an invalid value, a native PHP InvalidArgumentException with a dedicated message is throwned. There are some samples of generated methods:

// a string is expected to be 1 character length at least 
public function setImAddress($imAddress = null)
{
    // validation for constraint: minLength
    if ((is_scalar($imAddress) && strlen($imAddress) < 1) || (is_array($imAddress) && count($imAddress) < 1)) {
        throw new \InvalidArgumentException('Invalid length, please provide an array with 1 element(s) or a scalar of 1 character(s) at least', __LINE__);
    }
    // validation for constraint: string
    if (!is_null($imAddress) && !is_string($imAddress)) {
        throw new \InvalidArgumentException(sprintf('Invalid value, please provide a string, "%s" given', gettype($imAddress)), __LINE__);
    }
    $this->ImAddress = $imAddress;
    return $this;
}
// an array of string is expected
public function setEntry(array $entry = array())
{
    foreach ($entry as $additionalEntriesEntryItem) {
        // validation for constraint: itemType
        if (!is_string($additionalEntriesEntryItem)) {
            throw new \InvalidArgumentException(sprintf('The Entry property can only contain items of string, "%s" given', is_object($additionalEntriesEntryItem) ? get_class($additionalEntriesEntryItem) : gettype($additionalEntriesEntryItem)), __LINE__);
        }
    }
    $this->Entry = $entry;
    return $this;
}
// an enumeration value is exepected from the \Ews\EnumType\EwsMonthNamesType constant class
public function setMonth($month = null)
{
    // validation for constraint: enumeration
    if (!\Ews\EnumType\EwsMonthNamesType::valueIsValid($month)) {
        throw new \InvalidArgumentException(sprintf('Value "%s" is invalid, please use one of: %s', $month, implode(', ', \Ews\EnumType\EwsMonthNamesType::getValidValues())), __LINE__);
    }
    $this->Month = $month;
    return $this;
}
// a string is expected to match the pattern
public function setPersonId($personId = null)
{
    // validation for constraint: pattern
    if (is_scalar($personId) && !preg_match('/[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}/', $personId)) {
        throw new \InvalidArgumentException(sprintf('Invalid value, please provide a scalar value that matches "[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}", "%s" given', var_export($personId, true)), __LINE__);
    }
    // validation for constraint: string
    if (!is_null($personId) && !is_string($personId)) {
        throw new \InvalidArgumentException(sprintf('Invalid value, please provide a string, "%s" given', gettype($personId)), __LINE__);
    }
    $this->PersonId = $personId;
    return $this;
}

To conclude, if you're certain of the values you're passing (which can cause the SOAP Web Service to return you an error), you can avoid the validations rules to be generated by disabling this option.

  • Command line option name: validation
  • Methods names:
    • $options->setValidation(bool $validation)
    • $generator->setOptionValidation(bool $validation)

Gather operations methods

The operations are named such as they are logical and represent the action you want to execute. In order to help you find the method according to the operation and in order to lighten the Service classes, the methods are generated in different classes based on the name of the operation. Imagine you have these operations:

  • AddDelegate
  • AddNewImContactToGroup
  • ArchiveItem
  • GetStreamingEvents
  • GetItem

By default (value = start), you'll end up with 3 classes:

  • ServiceType\Add with these methods:
    • AddDelegate
    • AddNewImContactToGroup
  • ServiceType\Archive with these methods:
    • ArchiveItem
  • ServiceType\Get with these methods:
    • GetStreamingEvents
    • GetItem

It's based on the beginning (value = start or GeneratorOptions::VALUE_START) of the operation name. With the same logic, you can choose to name the classes based on the ending (value = end or GeneratorOptions::VALUE_END) of the operation name. Finally, you can also decide to not take into account the operation name in order to generate only one Service class that contains all the methods representing all the operations (value = none or GeneratorOptions::VALUE_NONE).

  • Command line option name: gathermethods
  • Methods names:
    • $options->setGatherMethods(string $validation)
    • $generator->setOptionGatherMethods(string $validation)

Generate tutorial

By default (value = true), the tutorial file is auto generated and holds all the possible operations you can call and all the setSoapHeader* methods you can call contained by the Service class whether it is needed or not. You can consider the tutorial.php file as a good stater kit to your development. You can take a look into the tutorial.php file of the PackageEws365 package.

  • Command line option name: gentutorial
  • Methods names:
    • $options->setGenerateTutorialFile(bool $tutorial)
    • $generator->setOptionGenerateTutorialFile(bool $tutorial)

Generation options

Depending on your usage, a default options file is used allowing to define your own options file in order to re-use it each time you need to generate a package with the same options.

Using the command line, the option-file-to-use determination is made checking if the file exists:

  • Does the config argument has been used with a valid file path? Use it if so, otherwise,
    • In the current command line directory, is there a wsdltophp.yml file? Use it if so, otherwise,

This means you can create your proper configuration file and use it.

  • Command line option name: config.
  • With PHP:
// Create an instance with your configuration file
$options = GeneratorOptions::instance("/path/my_generator_options_for_this_package.yml");
// Pass the instance to the generator
$generator = new Generator($options);

XSD types mapping

Depending on your usage, a default options file is used allowing to define your own XSD types mapping file in order to re-use it each time you need to generate a package with the same mapping.

This only has an effect on properties and parameters annotations. This does not allow to type hint the methods' parameters

Edit for release >= 4.0: properties, setters and getters are now types based on the XSD types mapping.

Using the command line, the option-file-to-use determination is made checking if the file exists:

  • Does the xsd-types-path argument has been used with a valid file path? Use it if so, otherwise,

This means you can create your proper configuration file and use it.

  • Command line option name: xsd-types-path.
  • With PHP:
// Create an instance with your configuration file
$options = (GeneratorOptions::instance())
    ->setXsdTypesPath('/path/to/the/xsd/types/file.yml');
// Pass the instance to the generator
$generator = new Generator($options);