phplaravellaravel-5soap-client

PHP Soapclient in Laravel 5


I want to use PHP's built-in SoapClient class in Laravel 5

I tried using it directly but it shows an error saying

Class 'App\Http\Controllers\SoapClient' not found.

I tried adding SoapClient in the aliases array in config/app.php like this

'SoapClient' => SoapClient::class

Still not working

what should I do?

Thanks in Advance...


Solution

  • The class needs to be imported, so either do that at the top:

    use SoapClient;

    or reference it directly later:

    $client = new \SoapClient($wsdl, $options);