edmondscommerce/ntlm-soap-client

A simple SOAP client that supports NTLM authentication for WSDL to PHP

v2.1.0 2024-10-25 10:04 UTC

This package is auto-updated.

Last update: 2024-10-25 10:11:15 UTC


README

This is a very simple SOAP client that supports NTLM authentication for use with WSDL To PHP

It has two classes, the Client that allows the username and password to be set, and tells CURL to use NTLM, and the Base which extends the Abstract client from WsdlToPhp and sets the options.

Usage

When generating the client you need to use the setSoapClientClass option and pass in the Base class. A simplified example is shown below

<?php

declare(strict_types=1);

use EdmondsCommerce\NtlmSoapClient\NTLMSoapBase;
use WsdlToPhp\PackageGenerator\ConfigurationReader\GeneratorOptions;
use WsdlToPhp\PackageGenerator\Generator\Generator;

$options = GeneratorOptions::instance();
$options
    ->setSoapClientClass(NTLMSoapBase::class)
    /* Other options as required */
    ;
// Generator instantiation
$generator = new Generator($options);
// Package generation
$generator->generatePackage();

When using the generated classes, pass in the WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_LOGIN and WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_PASSWORD options with the username and password.

Inspiration

The code for the Client came from the following ticket in the main project. I've just wrapped it in a library as I needed to use it in several different projects