yii2-soap-server

SOAP server for Yii2 based on the implementation of Yii1 WebService
4 followers

This extension is an adaptation of the SOAP Web Service available in Yii1, to Yii2. It is based on Yii version 1.1.14.

Note: Things might not work as Yii2 progresses and therefore I'd appreciate any issues or code changes to be done at the Github page

Requirements

  • Yii2
  • php-soap

Installation

Use composer and add the following line to your composer.json file:

"subdee/yii2-soap-server": "*"

Usage

Usage is similar to the explanation in the Yii guide

Define the custom action in your controller:

public function actions()
{
    return [
        ...,
        'myService' => [
            'class' => 'subdee\soapserver\SoapAction',
        ],
        ...,
    ];
}

Add the @soap keyword to the properly documented actions you want:

/**
* Returns hello and the name that you gave
*
* @param string $name Your name
* @return string
* @soap
*/
public function getHello($name)
{
    return 'Hello ' . $name;
}

Also, remember to turn off CSRF validation for the controller by setting its property:

public $enableCsrfValidation = false;

Resources

Total 1 comment

#18610 report it
protein at 2014/11/30 08:38am
Error in yii2-app-advanced
Your requirements could not be resolved to an installable set of packages.
 
  Problem 1
    - The requested package subdee/yii2-soap-server could not be found in any version, there may be a typo in the package name.

Leave a comment

Please to leave your comment.

Create extension
Downloads
No downloadable files yet