zimbra-api / soap-api

Zimbra SOAP client in PHP language
BSD 3-Clause "New" or "Revised" License
61 stars 48 forks source link

Cannot create MailApi #61

Open aleygues opened 1 month ago

aleygues commented 1 month ago

Hi there,

I'm trying to create a MailApi but I'm struggling on some missing params. I don't think it relates on the package itself, but on a PHP configuration issue maybe?

The code I want to use:

$mailApi = new MailApi($url); // this line is the error
$response = $mailApi->auth($mail, null, null, $token);

The fatal error I'm getting:

Fatal error:  Uncaught TypeError: Zimbra\Common\Soap\Client::__construct(): Argument #2 ($httpClient) must be of type Psr\Http\Client\ClientInterface, null given, called in /app/src/main/php/vendor/zimbra-api/soap-api/src/Common/Soap/ClientFactory.php on line 44 and defined in /app/src/main/php/vendor/zimbra-api/soap-api/src/Common/Soap/Client.php:86

The code is executed by PHP 8.3 (internal PHP server).

Do you have any clue on how to make PHP handles optional parameter correctly?

Thanks!

nguyennv commented 1 month ago

You must install one of http client implementations https://packagist.org/providers/psr/http-client-implementation