The Caller pattern in V2 clients
v6.xIn V2, generated clients no longer inherit from a base client. Instead, they use a Caller object to transport requests. This makes the client easier to own and manage.
use Calculator\Type\Add;
use Calculator\Type\AddResponse;
use Phpro\SoapClient\Caller\Caller;
class CalculatorClient
{
/**
* @var Caller
*/
private $caller;
public function __construct(Caller $caller)
{
$this->caller = $caller;
}
public function add(Add $parameters): AddResponse
{
return ($this->caller)('Add', $parameters);
}
}