Akshay Khale Akshay Khale - 20 days ago 5
PHP Question

PHP Soapclient in Laravel 5

I want to use php's built in SoapClient class in laravel 5

I tried using it directly is shows error saying


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


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

'SoapClient' => SoapClient::class


Still not working

what should I do?

Thanks in Advance...

Answer

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);

Comments