XUtils

PackageGenerator

Package Generator generates a PHP SDK from any WSDL.


In a project:

composer require wsdltophp/packagegenerator --dev

With command line:

$ wget https://phar.wsdltophp.com/wsdltophp-php7.phar
$ chmod +x wsdltophp-php7.phar
$ mv wsdltophp-php7.phar /usr/local/bin/wsdltophp

With Docker:

$ docker run --rm -it mikaelcom/wsdltophp:tagname

In a project:

use WsdlToPhp\PackageGenerator\ConfigurationReader\GeneratorOptions;
use WsdlToPhp\PackageGenerator\Generator\Generator;

// Options definition: the configuration file parameter is optional
$options = GeneratorOptions::instance(/* '/path/file.yml' */);
$options
    ->setOrigin('http://developer.ebay.com/webservices/latest/ebaySvc.wsdl')
    ->setDestination('./MySdk')
    ->setComposerName('myproject/mysdk');
// Generator instantiation
$generator = new Generator($options);
// Package generation
$generator->generatePackage();

With command line:

The command line is:

$ wsdltophp generate:package \
    --urlorpath="http://developer.ebay.com/webservices/latest/ebaySvc.wsdl" \
    --destination="./MySdk" \
    --composer-name="myproject/mysdk" \
    --force

In order to see all the used options, just remove the --force argument.

With Docker:

Such as with the command line above, simply use the docker run command line before:

$ docker run --rm -it --volume $PWD:/var/www mikaelcom/wsdltophp:tagname generate:package \
    --urlorpath="http://developer.ebay.com/webservices/latest/ebaySvc.wsdl" \
    --destination="/var/www/MySdk" \
    --composer-name="myproject/mysdk" \
    --force

In order to see all the used options, just remove the --force argument.

Versions

4.0

First released on 03 April 2021, maintained until version 6.0 is released. Please read the UPGRADE-4.0 note in order to acknowledge the main changes.

3.0

First released on 04 May 2018, maintained until version 5.0 is released. Please read the UPGRADE-3.0 note in order to acknowledge the main changes.

NOT MAINTAINED ANYMORE: even if version 5 is not published nor is expected soon, maintaining 2 versions, especially for an old PHP version, is time consuming, sorry for the people who would be still using it which would encounter issues fixed in the latest version.

2.0

Not maintained since 03 April 2021.

First released on 29 Apr 2016, maintained until version 4.0 is released.

1.0

Not maintained anymore

Testing

# launch all tests
$ phpunit

# launch a testsuite: command, configuration, utils, model, container, parser, file, packagegenerator
$ phpunit --testsuite=model

Testing using Docker

Thanks to the Docker image of phpfarm, tests can be run locally under any PHP version using the cli:

  • php-7.4

First of all, you need to create your container which you can do using docker-compose by running the below command line from the root directory of the project:

$ docker-compose up -d --build

You then have a container named package_generator in which you can run composer commands and php cli commands such as:

# install deps in container (using update ensure it does use the composer.lock file if there is any)
$ docker exec -it package_generator php-7.4 /usr/bin/composer update
# run tests in container
$ docker exec -it package_generator php-7.4 -dmemory_limit=-1 vendor/bin/phpunit

Credits

Developers who helped on this project are listed in the composer.json file as Contributor and are:


Articles

  • coming soon...