Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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...

like image 589
Akshay Khale Avatar asked Nov 01 '15 11:11

Akshay Khale


People also ask

What is SoapClient in laravel?

Soap - A Laravel SOAP client that provides a clean interface for handling requests and responses. Packages. March 29th, 2021.

What is SoapClient in PHP?

Description ¶ This is a low level API function that is used to make a SOAP call. Usually, in WSDL mode, SOAP functions can be called as methods of the SoapClient object. This method is useful in non-WSDL mode when soapaction is unknown, uri differs from the default or when sending and/or receiving SOAP Headers.

What is SoapClient?

SOAP is a communications XML-based protocol that lets applications exchange information through the internet. SOAP is platform independent and language independent. SOAP uses XML to specify a request and reply structure.


2 Answers

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

like image 149
Joel Hinz Avatar answered Sep 29 '22 18:09

Joel Hinz


I faced with same problem.

I activated Soap extension after I use php artisan serve command and although I restarted my apache server I received same error..

After too many tries I stop artisan and restart it again and that was the solution for me.

like image 44
Serdar D. Avatar answered Sep 29 '22 18:09

Serdar D.