Vonage / vonage-php-sdk-core

Vonage REST API client for PHP. API support for SMS, Voice, Text-to-Speech, Numbers, Verify (2FA) and more.
https://developer.vonage.com/
Apache License 2.0
917 stars 181 forks source link

Error during sending a message #360

Closed j-cata closed 1 year ago

j-cata commented 1 year ago

When I try to send a message, the code is trying to assign an array to the property $authHandler of the Vonage\Client\APIResource class, but that property is expecting an object that implements the Vonage\Client\Credentials\Handler\HandlerInterface interface

Expected Behavior

The message should be sent.

Current Behavior

I got this error : In APIResource.php line 352:
Cannot assign array to property Vonage\Client\APIResource::$authHandler of
type ?Vonage\Client\Credentials\Handler\HandlerInterface

Possible Solution

Steps to Reproduce (for bugs)

$basic = new Vonage\Client\Credentials\Basic($key, $token);
$vonage_client = new Vonage\Client($basic);
vonage_client->sms()->send(
    new Vonage\SMS\Message\Message(array(
        'to' => $phoneNumber,
        'from' => 'Test',
        'text' => $message
    ))
);

Your Environment

Symfony : 6.1.5 PHP : 8.1.11 vonage/client : 4.0.0

SergkeiM commented 1 year ago

@j-cata should be fixed in #361 (Released in v4.0.4) thanks to @dragonmantank

SecondeJK commented 1 year ago

Released as 4.0.4, thanks to @dragonmantank for hopping onto this outside of EMEA hours