PHPackages                             eftec/cloudking - 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. eftec/cloudking

ActiveLibrary[API Development](/categories/api)

eftec/cloudking
===============

A SOAP webserver for PHP

3.0(5y ago)2209MITPHPPHP &gt;=5.6CI failing

Since Apr 21Pushed 5y ago2 watchersCompare

[ Source](https://github.com/EFTEC/cloudking)[ Packagist](https://packagist.org/packages/eftec/cloudking)[ RSS](/packages/eftec-cloudking/feed)WikiDiscussions master Synced 6d ago

READMEChangelog (5)Dependencies (1)Versions (6)Used By (0)

cloudking
=========

[](#cloudking)

A SOAP Server Engine for PHP 5.6 and higher.

It supports SOAP 1.1, 1.2 or both. JAVA usually supports 1.1, C# supports both.

[![Packagist](https://camo.githubusercontent.com/b5863d2387c02025401a83e242faa5d8100688b46d5d5e719ddbf7a09b4c25f5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f65667465632f636c6f75646b696e672e737667)](https://packagist.org/packages/eftec/cloudking)[![Total Downloads](https://camo.githubusercontent.com/3368f139bbfaefdff5db37eba614762730eba0714911d80ae73ca5a679b31be4/68747470733a2f2f706f7365722e707567782e6f72672f65667465632f636c6f75646b696e672f646f776e6c6f616473)](https://packagist.org/packages/eftec/cloudking)![Maintenance](https://camo.githubusercontent.com/0080c39e8991e448d139858f9038668b6078ad14a26bacb65acf2ec3bfa9d661/68747470733a2f2f696d672e736869656c64732e696f2f6d61696e74656e616e63652f7965732f323032302e737667)![composer](https://camo.githubusercontent.com/08623182d7b037246f11c0ad4aec3fe405dcf9d668058398497abd1a9a770e9d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f6d706f7365722d253345312e362d626c75652e737667)![php](https://camo.githubusercontent.com/62fb387978945851f2340aa880bfc2a4164d74b4efcdf06b40833d91998dd145/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345352e362d677265656e2e737667)![php](https://camo.githubusercontent.com/0d20998129714e2662748003f3e0fab165e7f10d9dd4eb097376217b12c07b15/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d372e782d677265656e2e737667)![CocoaPods](https://camo.githubusercontent.com/347353606ed8f26b45bcf9da083db0063fa1dadd1baef36a5f3bf9ce1d127548/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f63732d37302532352d79656c6c6f772e737667)

Example of the UI

[![](docs/screenshot1.jpg)](docs/screenshot1.jpg)

Why we need Web Service SOAP?
-----------------------------

[](#why-we-need-web-service-soap)

Because some legacy projects are still using it. SOAP it is also declarative (instead of REST that lacks of a specification)

And why to use this library?

- It generates the server (service class and the client)
- It generates the WSDL.
- It works with complex structures.

Getting started
---------------

[](#getting-started)

### 1.Creating a Definition

[](#1creating-a-definition)

What is a definition class. It is a class that defined the name,namespace, functions and complex-types defined by the web service.

In this example, we are defining a simple function : function hello($param);

```
class ExampleDefinition {
    public static $service;

    /**
     * You must create this file manually.
     *
     * @param bool $gui if true then it shows the web gui
     */
    public static function init($gui = true) {
        $FILE = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['SCRIPT_NAME'];
        $NAMESPACE
            = 'http://www.examplenamespace.cl/'; // the namespace of the web service. It could be anything and not specifically an existing url
        $NAME_WS = 'Example2WS'; // the name of the service

        self::$service = new CloudKing($FILE, $NAMESPACE, $NAME_WS);
        self::$service->allowed_input['gui'] = $gui; // set to false to disable the web gui.
        self::$service->serviceInstance = null;
        self::$service->verbose = 2; // for debug purpose
        self::$service->description = 'Example server SoapKing';

        self::$service->addfunction('hello',
            [
                self::$service->param('param', 'string', true, false),
            ],
            [
                self::$service->param('return', 'string')
            ],
            'Example of function'
        );
    }

    public static function run() {
        $r = self::$service->run();
        echo $r;
    }
}
```

We will explain more about it later.

### 2. Running the first time.

[](#2-running-the-first-time)

Let's call the definition as follow

```
