2017 © Pedro Peláez
 

library laravel-soap

A SoapClient wrapper integration for Laravel

image

artisaninweb/laravel-soap

A SoapClient wrapper integration for Laravel

  • Monday, May 28, 2018
  • by artisaninweb
  • Repository
  • 21 Watchers
  • 367 Stars
  • 471,917 Installations
  • PHP
  • 9 Dependents
  • 0 Suggesters
  • 78 Forks
  • 9 Open issues
  • 29 Versions
  • 10 % Grown

The README.md

Laravel SoapClient Wrapper

A SoapClient wrapper integration for Laravel.br/ Makes it easy to use Soap in a Laravel application.br/, (*1)

Please report any bugs or features here: br/ https://github.com/artisaninweb/laravel-soap/issues/, (*2)

Installation

Laravel

Installation for Laravel 5.2 and above:

Run composer require artisaninweb/laravel-soap, (*3)

Add the service provider in app/config/app.php., (*4)

Artisaninweb\SoapWrapper\ServiceProvider::class, 

To use the alias, add this to the aliases in app/config/app.php., (*5)

'SoapWrapper' => Artisaninweb\SoapWrapper\Facade\SoapWrapper::class,  

Installation for Laravel 5.1 and below :

Add artisaninweb/laravel-soap as requirement to composer.json, (*6)

{
    "require": {
        "artisaninweb/laravel-soap": "0.3.*"
    }
}

If you're using Laravel 5.5 or higher you can skip the two config setups below., (*7)

Add the service provider in app/config/app.php., (*8)

'Artisaninweb\SoapWrapper\ServiceProvider'

To use the facade add this to the facades in app/config/app.php., (*9)

'SoapWrapper' => 'Artisaninweb\SoapWrapper\Facade'

Lumen

Open bootstrap/app.php and register the required service provider:, (*10)

$app->register(Artisaninweb\SoapWrapper\ServiceProvider::class);

register class alias:, (*11)

class_alias('Artisaninweb\SoapWrapper\Facade', 'SoapWrapper');

Facades must be enabled., (*12)

Usage

How to add a service to the wrapper and use it., (*13)

<?php

namespace App\Http\Controllers;

use Artisaninweb\SoapWrapper\SoapWrapper;
use App\Soap\Request\GetConversionAmount;
use App\Soap\Response\GetConversionAmountResponse;

class SoapController
{
  /**
   * @var SoapWrapper
   */
  protected $soapWrapper;

  /**
   * SoapController constructor.
   *
   * @param SoapWrapper $soapWrapper
   */
  public function __construct(SoapWrapper $soapWrapper)
  {
    $this->soapWrapper = $soapWrapper;
  }

  /**
   * Use the SoapWrapper
   */
  public function show() 
  {
    $this->soapWrapper->add('Currency', function ($service) {
      $service
        ->wsdl('http://currencyconverter.kowabunga.net/converter.asmx?WSDL')
        ->trace(true)
        ->classmap([
          GetConversionAmount::class,
          GetConversionAmountResponse::class,
        ]);
    });

    // Without classmap
    $response = $this->soapWrapper->call('Currency.GetConversionAmount', [
      'CurrencyFrom' => 'USD', 
      'CurrencyTo'   => 'EUR', 
      'RateDate'     => '2014-06-05', 
      'Amount'       => '1000',
    ]);

    var_dump($response);

    // With classmap
    $response = $this->soapWrapper->call('Currency.GetConversionAmount', [
      new GetConversionAmount('USD', 'EUR', '2014-06-05', '1000')
    ]);

    var_dump($response);
    exit;
  }
}

Service functions

$this->soapWrapper->add('Currency', function ($service) {
    $service
        ->wsdl()                 // The WSDL url
        ->trace(true)            // Optional: (parameter: true/false)
        ->header()               // Optional: (parameters: $namespace,$name,$data,$mustunderstand,$actor)
        ->customHeader()         // Optional: (parameters: $customerHeader) Use this to add a custom SoapHeader or extended class                
        ->cookie()               // Optional: (parameters: $name,$value)
        ->location()             // Optional: (parameter: $location)
        ->certificate()          // Optional: (parameter: $certLocation)
        ->cache(WSDL_CACHE_NONE) // Optional: Set the WSDL cache

        // Optional: Set some extra options
        ->options([
            'login' => 'username',
            'password' => 'password'
        ])

        // Optional: Classmap
        ->classmap([
          GetConversionAmount::class,
          GetConversionAmountResponse::class,
        ]);
});

Classmap

If you are using classmap you can add folders like for example: - App\Soap - App\Soap\Request - App\Soap\Response, (*14)

Request: App\Soap\Request\GetConversionAmount, (*15)

<?php

namespace App\Soap\Request;

class GetConversionAmount
{
  /**
   * @var string
   */
  protected $CurrencyFrom;

  /**
   * @var string
   */
  protected $CurrencyTo;

  /**
   * @var string
   */
  protected $RateDate;

  /**
   * @var string
   */
  protected $Amount;

  /**
   * GetConversionAmount constructor.
   *
   * @param string $CurrencyFrom
   * @param string $CurrencyTo
   * @param string $RateDate
   * @param string $Amount
   */
  public function __construct($CurrencyFrom, $CurrencyTo, $RateDate, $Amount)
  {
    $this->CurrencyFrom = $CurrencyFrom;
    $this->CurrencyTo   = $CurrencyTo;
    $this->RateDate     = $RateDate;
    $this->Amount       = $Amount;
  }

  /**
   * @return string
   */
  public function getCurrencyFrom()
  {
    return $this->CurrencyFrom;
  }

  /**
   * @return string
   */
  public function getCurrencyTo()
  {
    return $this->CurrencyTo;
  }

  /**
   * @return string
   */
  public function getRateDate()
  {
    return $this->RateDate;
  }

  /**
   * @return string
   */
  public function getAmount()
  {
    return $this->Amount;
  }
}

Response: App\Soap\Response\GetConversionAmountResponse, (*16)

<?php

namespace App\Soap\Response;

class GetConversionAmountResponse
{
  /**
   * @var string
   */
  protected $GetConversionAmountResult;

  /**
   * GetConversionAmountResponse constructor.
   *
   * @param string
   */
  public function __construct($GetConversionAmountResult)
  {
    $this->GetConversionAmountResult = $GetConversionAmountResult;
  }

  /**
   * @return string
   */
  public function getGetConversionAmountResult()
  {
    return $this->GetConversionAmountResult;
  }
}

The Versions

28/05 2018

dev-master

9999999-dev

A SoapClient wrapper integration for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-soap *

 

by Michael van de Rijt

laravel wrapper client soap

28/05 2018

0.3.0.9

0.3.0.9

A SoapClient wrapper integration for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-soap *

 

by Michael van de Rijt

laravel wrapper client soap

22/01 2018

0.3.0.8

0.3.0.8

A SoapClient wrapper integration for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-soap *

 

by Michael van de Rijt

laravel wrapper client soap

03/04 2017

0.3.0.7

0.3.0.7

A SoapClient wrapper integration for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-soap *

 

by Michael van de Rijt

laravel wrapper client soap

14/03 2017

0.3.0.6

0.3.0.6

A SoapClient wrapper integration for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-soap *

 

by Michael van de Rijt

laravel wrapper client soap

14/03 2017

0.3.0.5

0.3.0.5

A SoapClient wrapper integration for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-soap *

 

by Michael van de Rijt

laravel wrapper client soap

25/01 2017

0.3.0.4

0.3.0.4

A SoapClient wrapper integration for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-soap *

 

by Michael van de Rijt

laravel wrapper client soap

25/01 2017

0.3.0.3

0.3.0.3

A SoapClient wrapper integration for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-soap *

 

by Michael van de Rijt

laravel wrapper client soap

25/01 2017

dev-develop

dev-develop

A SoapClient wrapper integration for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-soap *

 

by Michael van de Rijt

laravel wrapper client soap

05/01 2017

0.3.0.2

0.3.0.2

A SoapClient wrapper integration for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-soap *

 

by Michael van de Rijt

laravel wrapper client soap

20/12 2016

0.3.0.1

0.3.0.1

A SoapClient wrapper integration for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-soap *

 

by Michael van de Rijt

laravel wrapper client soap

15/12 2016

0.3.0

0.3.0.0

A SoapClient wrapper integration for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-soap *

 

by Michael van de Rijt

laravel wrapper client soap

17/06 2015

0.2.5.10

0.2.5.10

A SoapClient wrapper integration for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Michael van de Rijt

laravel wrapper client soap

13/05 2015

0.2.5.9

0.2.5.9

A SoapClient wrapper integration for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Michael van de Rijt

laravel wrapper client soap

10/05 2015

0.2.5.8

0.2.5.8

A SoapClient wrapper integration for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Michael van de Rijt

laravel wrapper client soap

11/02 2015

0.2.5.7

0.2.5.7

A SoapClient wrapper integration for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Michael van de Rijt

laravel wrapper client soap

29/01 2015

0.2.5.6

0.2.5.6

A SoapClient wrapper integration for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Michael van de Rijt

laravel wrapper client soap

03/11 2014

0.2.5.5

0.2.5.5

A SoapClient wrapper integration for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Michael van de Rijt

laravel wrapper client soap

17/10 2014

0.2.5.4

0.2.5.4

A SoapClient wrapper integration for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Michael van de Rijt

laravel wrapper client soap

29/09 2014

0.2.5.3

0.2.5.3

A SoapClient wrapper integration for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Michael van de Rijt

laravel wrapper client soap

29/09 2014

0.2.5.2

0.2.5.2

A SoapClient wrapper integration for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Michael van de Rijt

laravel wrapper client soap

29/09 2014

0.2.5.1

0.2.5.1

A SoapClient wrapper integration for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Michael van de Rijt

laravel wrapper client soap

29/09 2014

0.2.5

0.2.5.0

A SoapClient wrapper integration for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Michael van de Rijt

laravel wrapper client soap

29/09 2014

0.2.4

0.2.4.0

A SoapClient wrapper integration for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Michael van de Rijt

laravel wrapper client soap

26/09 2014

0.2.3

0.2.3.0

A SoapClient wrapper integration for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Michael van de Rijt

laravel wrapper client soap

18/09 2014

0.2.2

0.2.2.0

A SoapClient wrapper integration for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Michael van de Rijt

laravel wrapper client soap

13/09 2014

0.2.1

0.2.1.0

A SoapClient wrapper integration for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Michael van de Rijt

laravel wrapper client soap

08/08 2014

0.2

0.2.0.0

A SoapClient wrapper integration for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Michael van de Rijt

laravel wrapper client soap

06/08 2014

0.1

0.1.0.0

A SoapClient wrapper integration for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Michael van de Rijt

laravel wrapper client soap