Giter Site home page Giter Site logo

infobip-api-php-client's Introduction

Infobip API PHP Client

Packagist MIT License

This is a PHP Client for Infobip API and you can use it as a dependency to add Infobip APIs to your application. To use this, you'll need an Infobip account. If not already having one, you can create a free trial account here.

infobip-api-php-client is built on top of OpenAPI Specification, generated by Infobip OSCAR service powered by OpenAPI Generator.

Infobip

Table of contents:

Documentation

Detailed documentation about Infobip API can be found here. The current version of this library includes this subset of Infobip products:

General Info

For infobip-api-php-client versioning we use Semantic Versioning scheme.

Published under MIT License.

The library requires PHP version >= 8.0.

Installation

Using Composer

To start using the library add it as dependecy in your composer.json file like shown below.

"require": {
	"infobip/infobip-api-php-client": "5.0.0"
}

And simply run composer install to download dependencies.

Without Composer

If your setup prevents you from using composer you can manually download this package and all of its dependencies and reference them from your code. However, there are solutions that can automate this process. One of them is php-download online tool. You can use it to find pre-composed infobip client package, download it from there and use in your project without manually collecting the dependencies.

Quickstart

Initialize the Configuration & HTTP client

The library supports the API Key Header authentication method. Once you have an Infobip account, you can manage your API keys through the Infobip API key management page.

To see your base URL, log in to the Infobip API Resource hub with your Infobip credentials or visit your Infobip account.

    use Infobip\Configuration;

    $configuration = new Configuration(
        host: 'your-base-url',
        apiKey: 'your-api-key'
    );

Send an SMS

See below, a simple example of sending a single SMS message to a single recipient.

    use Infobip\ApiException;
    use Infobip\Model\SmsAdvancedTextualRequest;
    use Infobip\Model\SmsDestination;
    use Infobip\Model\SmsTextualMessage;

    $sendSmsApi = new SmsApi(config: $configuration);

    $message = new SmsTextualMessage(
        destinations: [
            new SmsDestination(to: '41793026727')
        ],
        from: 'InfoSMS',
        text: 'This is a dummy SMS message sent using infobip-api-php-client'
    );

    $request = new SmsAdvancedTextualRequest(messages: [$message]);

    try {
        $smsResponse = $sendSmsApi->sendSmsMessage($request);
    } catch (ApiException $apiException) {
        // HANDLE THE EXCEPTION
    }

Fields provided within ApiException object are code referring to the HTTP Code response, as well as the responseHeaders and responseBody. Also, you can get the deserialized response body using getResponseObject method.

    $apiException->getCode();
    $apiException->getResponseHeaders();
    $apiException->getResponseBody();
    $apiException->getResponseObject();

Additionally, you can retrieve a bulkId and a messageId from the SmsResponse object to use for troubleshooting or fetching a delivery report for a given message or a bulk. Bulk ID will be received only when you send a message to more than one destination address or multiple messages in a single request.

    $bulkId = $smsResponse->getBulkId();
    $messages = $smsResponse->getMessages();
    $messageId = (!empty($messages)) ? current($messages)->getMessageId() : null;

Receive SMS message delivery report

For each SMS that you send out, we can send you a message delivery report in real time. All you need to do is specify your endpoint when sending SMS in the notifyUrl field within SmsTextualMessage, or subscribe for reports by contacting our support team at [email protected].

You can use data models from the library and the pre-configured Infobip\ObjectSerializer serializer.

Example of webhook implementation:

    use Infobip\Model\SmsReportResponse;
    use Infobip\ObjectSerializer;

    $objectSerializer = new ObjectSerializer();

    $data = \file_get_contents('php://input');

    /**
     * @var SmsReportResponse $deliveryResult
     */
    $deliveryResult = $objectSerializer->deserialize($data, SmsReportResponse::class);

    foreach ($deliveryResult->getResults() ?? [] as $report) {
        echo $report->getMessageId() . " - " . $report->getStatus()->getName() . "\n";
    }

If you prefer to use your own serializer, please pay attention to the supported date format.

Fetching delivery reports

If you are for any reason unable to receive real-time delivery reports on your endpoint, you can use messageId or bulkId to fetch them. Each request will return a batch of delivery reports - only once. See documentation for more details.

    $deliveryReports = $sendSmsApi
        ->getOutboundSmsMessageDeliveryReports(
            bulkId: 'some-bulk-id',
            messageId: 'some-message-id',
            limit: 10
        );

    foreach ($deliveryReports->getResults() ?? [] as $report) {
        echo $report->getMessageId() . " - " . $report->getStatus()->getName() . "\n";
    }

Unicode & SMS preview

Infobip API supports Unicode characters and automatically detects encoding. Unicode and non-standard GSM characters use additional space, avoid unpleasant surprises and check how different message configurations will affect your message text, number of characters and message parts.

    use Infobip\Model\SmsPreviewRequest;

    $previewResponse = $sendSmsApi
        ->previewSmsMessage(
            new SmsPreviewRequest(
                text: 'Let\'s see how many characters will remain unused in this message.'
            )
        );

    foreach ($previewResponse->getPreviews() ?? [] as $preview) {
        echo sprintf(
            'Characters remaining: %s, text preview: %s',
            $preview->getCharactersRemaining(),
            $preview->getTextPreview()
        ) . PHP_EOL;
    }

Receive incoming SMS

If you want to receive SMS messages from your subscribers we can have them delivered to you in real time. When you buy and configure a number capable of receiving SMS, specify your endpoint, as explained in documentation. e.g. https://{yourDomain}/incoming-sms. Example of webhook implementation:

    use Infobip\ObjectSerializer;
    use Infobip\Model\SmsInboundMessageResult;

    $objectSerializer = new ObjectSerializer();

    $data = \file_get_contents('php://input');

    /**
     * @var SmsInboundMessageResult $messages
     */
    $messages = $objectSerializer->deserialize($data, SmsInboundMessageResult::class);

    foreach ($messages->getResults() ?? [] as $message) {
        echo $message-> getFrom() . " - " . $message-> getCleanText() . "\n";
    }

Two-Factor Authentication (2FA)

For 2FA quick start guide please check these examples.

Send email

For send email quick start guide please check these examples.

WhatsApp

For WhatsApp quick start guide, view these examples.

Ask for help

Feel free to open issues on the repository for any issue or feature request. As per pull requests, for details check the CONTRIBUTING file related to it - in short, we will not merge any pull requests, this code is auto-generated.

This code is auto generated, and we are unable to merge any pull request from here, but we will review and implement changes directly within our pipeline, as described in the CONTRIBUTING file.

For anything that requires our imminent attention, contact us @ [email protected].

infobip-api-php-client's People

Contributors

dario-ib avatar denis-cutic avatar dzubchik avatar hkozacinski-ib avatar ibirogar avatar josipk-ib avatar nmenkovic-ib avatar pducic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

infobip-api-php-client's Issues

Impossible to get HTTP response status

Method \infobip\api\AbstractApiClient::executeRequest incapsulates HTTP response status and it's impossible to get it. There are a lot of situations where it needs to be defined. For example: https://dev.infobip.com/docs/2fa-status-codes-and-error-details or https://dev.infobip.com/docs/send-single-sms

Also it's possible to get exception with HTML (not json) content and without HTTP status information client code unable to handle it in a good way!
http://joxi.ru/12MjQ5f4YOEeAJ?d=1

Any sample of sending bulk messages using loop

Thank you for this library.
Is there any example describing how to send multiple messages at once by looping over them dynamically? assuming you have hundreds of SMS messages fetched from your DB in such a way that each one have to be sent to its unique destination number, like the following:

foreach($messages as $msg){
    //Destination is $msg['dest']
    //Content is $msg['content']
    //Make a call to the API in order to send $msg
}

Unable to connect with Laravel

Only the Laravel versions 10 and 11 seems to have the compatible with php and api but having difficulty in locating modules.
Documentation for whatsapp api to be connected with Laravel, would be much appreciated.

Install

manifest cannot be larger than 100 MB in phar

PHP 8.1 Deprecation messages

PHP Deprecated:  Return type of Infobip\Model\SmsInboundMessageResult::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/phil/src/infobip/vendor/infobip/infobip-api-php-client/Infobip/Model/SmsInboundMessageResult.php on line 296

Deprecated: Return type of Infobip\Model\SmsInboundMessageResult::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/phil/src/infobip/vendor/infobip/infobip-api-php-client/Infobip/Model/SmsInboundMessageResult.php on line 296
PHP Deprecated:  Return type of Infobip\Model\SmsInboundMessageResult::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/phil/src/infobip/vendor/infobip/infobip-api-php-client/Infobip/Model/SmsInboundMessageResult.php on line 308

Deprecated: Return type of Infobip\Model\SmsInboundMessageResult::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/phil/src/infobip/vendor/infobip/infobip-api-php-client/Infobip/Model/SmsInboundMessageResult.php on line 308
PHP Deprecated:  Return type of Infobip\Model\SmsInboundMessageResult::offsetSet($offset, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/phil/src/infobip/vendor/infobip/infobip-api-php-client/Infobip/Model/SmsInboundMessageResult.php on line 321

Deprecated: Return type of Infobip\Model\SmsInboundMessageResult::offsetSet($offset, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/phil/src/infobip/vendor/infobip/infobip-api-php-client/Infobip/Model/SmsInboundMessageResult.php on line 321
PHP Deprecated:  Return type of Infobip\Model\SmsInboundMessageResult::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/phil/src/infobip/vendor/infobip/infobip-api-php-client/Infobip/Model/SmsInboundMessageResult.php on line 337

Deprecated: Return type of Infobip\Model\SmsInboundMessageResult::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/phil/src/infobip/vendor/infobip/infobip-api-php-client/Infobip/Model/SmsInboundMessageResult.php on line 337
PHP Deprecated:  Return type of Infobip\Model\SmsInboundMessageResult::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/phil/src/infobip/vendor/infobip/infobip-api-php-client/Infobip/Model/SmsInboundMessageResult.php on line 349

Deprecated: Return type of Infobip\Model\SmsInboundMessageResult::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/phil/src/infobip/vendor/infobip/infobip-api-php-client/Infobip/Model/SmsInboundMessageResult.php on line 349

is there a way of sending sms using account key only

hello sir

i create a new system that can sent sms using your api
with username and password
is there a way of sending sms using account key
i create a sub account and i want to sent sms using that account to validate the parent account
but the main problem is that i can't sent sms cus the parent password encrypt to md5 into my database

the parent username and password is the same to user db account

hope my english !!

Short URL not working in the 3.0 version

I started to implement the new 3.0 version to send SMS messages, but, on the testing of the SDK, when links is used they don't get shorten.

Can your team check if this is some bug or if now this SDK dont will short links?

v3 locked to Guzzle ^6.5

V3 of your package has guzzlehttp/guzzle: ^6.5 as dependency, so it's not usable if you have already an upper version of guzzle.

Should be possible to update that dependency to something greater than 6.5?

Countries

Hi..I use you library in order to sent SMS. But there is a problem when I sent messages to Kenya.inside cloud.Infobip website I can send normally but never from my application. However I can sent normally to everywhere else. I receive pending enroute status with no errors.

Issue with getWhatsAppMediaMetadataResponse Returning Null

I am trying to retrieve the metadata of a media file using the getWhatsAppMediaMetadata function. However, the function returns a getWhatsAppMediaMetadataResponse that is null. I am unsure if I am missing something in my implementation or if this is a bug in the function.

  • Original code
    private function getWhatsAppMediaMetadataResponse(ResponseInterface $response, UriInterface $requestUri): mixed
    {
        $statusCode = $response->getStatusCode();
        $responseBody = $response->getBody();
        $responseHeaders = $response->getHeaders();

        if ($statusCode < 200 || $statusCode > 299) {
            throw new ApiException(
                sprintf('[%d] API Error (%s)', $statusCode, $requestUri),
                $statusCode,
                $responseHeaders,
                $responseBody
            );
        }

        $responseResult = null;

        return $responseResult;
    }
  • Recommended code
    private function getWhatsAppMediaMetadataResponse(ResponseInterface $response, UriInterface $requestUri): mixed
    {
        $statusCode = $response->getStatusCode();
        $responseBody = $response->getBody();
        $responseHeaders = $response->getHeaders();

        if ($statusCode < 200 || $statusCode > 299) {
            throw new ApiException(
                sprintf('[%d] API Error (%s)', $statusCode, $requestUri),
                $statusCode,
                $responseHeaders,
                $responseBody
            );
        }

        return $responseHeaders;
    }

PENDING_ENROUTE

Hi
I have received PENDING_ENROUTE response.
How to check whether its delivered or not?

How to send SMS to multiple numbers

There is nowhere indicated in the readme about how to send a message to multiple numbers. The closest to that is somewhat confusing.
In the line below:

$destination = new infobip\api\model\Destination();
$destination->setTo(TO);

$message = new infobip\api\model\sms\mt\send\Message();
$message->setFrom(FROM);
$message->setDestinations([$destination]);

what is passed to $destination->setTo()? How does one add multiple phone numbers, assuming this is supposed to handle that?

Files failing PHPCS

PHP Code Sniffer is the standard linter of choice for PHP development. We ignore it in a lot of files (we shouldn't) and in the files we don't ignore we fail it.

$ ddev composer lint
> ./vendor/bin/phpcs ./Infobip

FILE: /var/www/html/Infobip/ApiException.php
-----------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AND 6 WARNINGS AFFECTING 10 LINES
-----------------------------------------------------------------------------------------------------
  8 | ERROR   | Content of the @author tag must be in the form "Display Name <[email protected]>"
 10 | ERROR   | Missing @license tag in file comment
 15 | WARNING | Line exceeds 85 characters; contains 87 characters
 19 | WARNING | Line exceeds 85 characters; contains 215 characters
 21 | WARNING | Line exceeds 85 characters; contains 120 characters
 33 | ERROR   | Content of the @author tag must be in the form "Display Name <[email protected]>"
 35 | ERROR   | Missing @license tag in class comment
 65 | WARNING | Line exceeds 85 characters; contains 123 characters
 67 | WARNING | Line exceeds 85 characters; contains 102 characters
 87 | WARNING | Line exceeds 85 characters; contains 99 characters
-----------------------------------------------------------------------------------------------------


FILE: /var/www/html/Infobip/Configuration.php
-----------------------------------------------------------------------------------------------------
FOUND 9 ERRORS AND 3 WARNINGS AFFECTING 12 LINES
-----------------------------------------------------------------------------------------------------
  8 | ERROR   | Content of the @author tag must be in the form "Display Name <[email protected]>"
 10 | ERROR   | Missing @license tag in file comment
 15 | WARNING | Line exceeds 85 characters; contains 87 characters
 19 | WARNING | Line exceeds 85 characters; contains 215 characters
 21 | WARNING | Line exceeds 85 characters; contains 120 characters
 26 | ERROR   | Missing doc comment for class Configuration
 31 | ERROR   | Missing doc comment for function __construct()
 41 | ERROR   | Missing doc comment for function getHost()
 46 | ERROR   | Missing doc comment for function getApiKeyHeader()
 51 | ERROR   | Missing doc comment for function getApiKey()
 56 | ERROR   | Missing doc comment for function getUserAgent()
 61 | ERROR   | Missing doc comment for function getTempFolderPath()
-----------------------------------------------------------------------------------------------------


FILE: /var/www/html/Infobip/DeprecationChecker.php
--------------------------------------------------------------------------------------------------------------
FOUND 12 ERRORS AND 10 WARNINGS AFFECTING 16 LINES
--------------------------------------------------------------------------------------------------------------
  12 | ERROR   | Content of the @author tag must be in the form "Display Name <[email protected]>"
  14 | ERROR   | Missing @license tag in file comment
  19 | WARNING | Line exceeds 85 characters; contains 87 characters
  23 | WARNING | Line exceeds 85 characters; contains 215 characters
  25 | WARNING | Line exceeds 85 characters; contains 120 characters
  35 | ERROR   | Missing doc comment for class DeprecationChecker
  44 | ERROR   | Missing doc comment for function __construct()
  48 | ERROR   | Missing short description in doc comment
  48 | ERROR   | Doc comment for parameter "$request" missing
  48 | ERROR   | Doc comment for parameter "$response" missing
  50 | ERROR   | Missing @return tag in function comment
  51 | WARNING | Line exceeds 85 characters; contains 87 characters
  63 | WARNING | Line exceeds 85 characters; contains 91 characters
  83 | ERROR   | Missing doc comment for function logGone()
  83 | ERROR   | Private method name "DeprecationChecker::logGone" must be prefixed with an underscore
  83 | WARNING | Line exceeds 85 characters; contains 86 characters
  90 | WARNING | Line exceeds 85 characters; contains 91 characters
  99 | ERROR   | Missing doc comment for function logDeprecation()
  99 | ERROR   | Private method name "DeprecationChecker::logDeprecation" must be prefixed with an underscore
  99 | WARNING | Line exceeds 85 characters; contains 101 characters
 104 | WARNING | Line exceeds 85 characters; contains 87 characters
 112 | WARNING | Line exceeds 85 characters; contains 95 characters
--------------------------------------------------------------------------------------------------------------


FILE: /var/www/html/Infobip/EnumNormalizer.php
---------------------------------------------------------------------------------------------------------
FOUND 25 ERRORS AND 8 WARNINGS AFFECTING 20 LINES
---------------------------------------------------------------------------------------------------------
 10 | ERROR   | [ ] Content of the @author tag must be in the form "Display Name <[email protected]>"
 12 | WARNING | [ ] PHP version not specified
 12 | ERROR   | [ ] Missing @license tag in file comment
 17 | WARNING | [ ] Line exceeds 85 characters; contains 87 characters
 21 | WARNING | [ ] Line exceeds 85 characters; contains 215 characters
 23 | WARNING | [ ] Line exceeds 85 characters; contains 120 characters
 35 | ERROR   | [ ] Missing doc comment for class EnumNormalizer
 37 | ERROR   | [ ] Missing short description in doc comment
 37 | ERROR   | [ ] Doc comment for parameter "$object" missing
 37 | ERROR   | [ ] Doc comment for parameter "$format" missing
 37 | ERROR   | [ ] Doc comment for parameter "$context" missing
 39 | ERROR   | [x] Tag value for @throws tag indented incorrectly; expected 5 spaces but found 1
 40 | ERROR   | [ ] Missing @return tag in function comment
 41 | WARNING | [ ] Line exceeds 85 characters; contains 96 characters
 44 | WARNING | [ ] Line exceeds 85 characters; contains 90 characters
 50 | ERROR   | [ ] Missing short description in doc comment
 50 | ERROR   | [ ] Doc comment for parameter "$data" missing
 50 | ERROR   | [ ] Doc comment for parameter "$format" missing
 52 | ERROR   | [ ] Missing @return tag in function comment
 58 | ERROR   | [ ] Missing short description in doc comment
 58 | ERROR   | [ ] Doc comment for parameter "$data" missing
 58 | ERROR   | [ ] Doc comment for parameter "$type" missing
 58 | ERROR   | [ ] Doc comment for parameter "$format" missing
 58 | ERROR   | [ ] Doc comment for parameter "$context" missing
 60 | ERROR   | [x] Tag value for @throws tag indented incorrectly; expected 5 spaces but found 1
 61 | ERROR   | [ ] Missing @return tag in function comment
 62 | WARNING | [ ] Line exceeds 85 characters; contains 117 characters
 77 | ERROR   | [ ] Missing short description in doc comment
 77 | ERROR   | [ ] Doc comment for parameter "$data" missing
 77 | ERROR   | [ ] Doc comment for parameter "$type" missing
 77 | ERROR   | [ ] Doc comment for parameter "$format" missing
 79 | ERROR   | [ ] Missing @return tag in function comment
 80 | WARNING | [ ] Line exceeds 85 characters; contains 99 characters
---------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------


FILE: /var/www/html/Infobip/Model/EnumInterface.php
---------------------------------------------------------------------------------------------------------
FOUND 8 ERRORS AND 4 WARNINGS AFFECTING 9 LINES
---------------------------------------------------------------------------------------------------------
  3 | ERROR   | [ ] Missing short description in doc comment
  4 | ERROR   | [x] Tag value for @package tag indented incorrectly; expected 1 spaces but found 2
  5 | ERROR   | [ ] Content of the @author tag must be in the form "Display Name <[email protected]>"
  5 | ERROR   | [x] Tag value for @author tag indented incorrectly; expected 2 spaces but found 3
  6 | ERROR   | [x] Tag value for @link tag indented incorrectly; expected 4 spaces but found 5
  7 | WARNING | [ ] PHP version not specified
  7 | ERROR   | [ ] Missing @category tag in file comment
  7 | ERROR   | [ ] Missing @license tag in file comment
 14 | WARNING | [ ] Line exceeds 85 characters; contains 87 characters
 18 | WARNING | [ ] Line exceeds 85 characters; contains 215 characters
 20 | WARNING | [ ] Line exceeds 85 characters; contains 120 characters
 27 | ERROR   | [ ] Missing doc comment for interface EnumInterface
---------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------


FILE: /var/www/html/Infobip/Model/ModelInterface.php
---------------------------------------------------------------------------------------------------------
FOUND 10 ERRORS AND 4 WARNINGS AFFECTING 11 LINES
---------------------------------------------------------------------------------------------------------
  5 | ERROR   | [ ] Missing short description in doc comment
  6 | ERROR   | [x] Tag value for @package tag indented incorrectly; expected 1 spaces but found 2
  7 | ERROR   | [ ] Content of the @author tag must be in the form "Display Name <[email protected]>"
  7 | ERROR   | [x] Tag value for @author tag indented incorrectly; expected 2 spaces but found 3
  8 | ERROR   | [x] Tag value for @link tag indented incorrectly; expected 4 spaces but found 5
  9 | WARNING | [ ] PHP version not specified
  9 | ERROR   | [ ] Missing @category tag in file comment
  9 | ERROR   | [ ] Missing @license tag in file comment
 14 | WARNING | [ ] Line exceeds 85 characters; contains 87 characters
 18 | WARNING | [ ] Line exceeds 85 characters; contains 215 characters
 20 | WARNING | [ ] Line exceeds 85 characters; contains 120 characters
 25 | ERROR   | [ ] Missing doc comment for interface ModelInterface
 29 | ERROR   | [ ] Missing doc comment for function getModelName()
 31 | ERROR   | [ ] Missing doc comment for function getDiscriminator()
---------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------


FILE: /var/www/html/Infobip/ObjectSerializer.php
----------------------------------------------------------------------------------------------------------------------
FOUND 52 ERRORS AND 11 WARNINGS AFFECTING 41 LINES
----------------------------------------------------------------------------------------------------------------------
   9 | ERROR   | [ ] Content of the @author tag must be in the form "Display Name <[email protected]>"
  11 | ERROR   | [ ] Missing @license tag in file comment
  16 | WARNING | [ ] Line exceeds 85 characters; contains 87 characters
  20 | WARNING | [ ] Line exceeds 85 characters; contains 215 characters
  22 | WARNING | [ ] Line exceeds 85 characters; contains 120 characters
  49 | ERROR   | [ ] Missing doc comment for class ObjectSerializer
  53 | ERROR   | [ ] Private member variable "serializer" must be prefixed with an underscore
  54 | ERROR   | [ ] Private member variable "validator" must be prefixed with an underscore
  56 | ERROR   | [ ] Missing doc comment for function __construct()
  59 | WARNING | [ ] Line exceeds 85 characters; contains 107 characters
  60 | WARNING | [ ] Line exceeds 85 characters; contains 107 characters
  68 | WARNING | [ ] Line exceeds 85 characters; contains 90 characters
  92 | ERROR   | [ ] Missing doc comment for function serialize()
  92 | WARNING | [ ] Line exceeds 85 characters; contains 88 characters
 101 | ERROR   | [ ] Missing doc comment for function deserialize()
 121 | ERROR   | [ ] Missing short description in doc comment
 121 | ERROR   | [ ] Doc comment for parameter "$data" missing
 121 | ERROR   | [ ] Doc comment for parameter "$context" missing
 123 | ERROR   | [ ] Missing @return tag in function comment
 129 | ERROR   | [ ] Missing short description in doc comment
 129 | ERROR   | [ ] Doc comment for parameter "$data" missing
 129 | ERROR   | [ ] Doc comment for parameter "$type" missing
 129 | ERROR   | [ ] Doc comment for parameter "$context" missing
 131 | ERROR   | [ ] Missing @return tag in function comment
 132 | WARNING | [ ] Line exceeds 85 characters; contains 86 characters
 141 | ERROR   | [ ] Missing short description in doc comment
 141 | ERROR   | [ ] Doc comment for parameter "$value" missing
 145 | ERROR   | [ ] Missing @return tag in function comment
 151 | ERROR   | [ ] Missing short description in doc comment
 151 | ERROR   | [ ] Doc comment for parameter "$object" missing
 157 | ERROR   | [ ] Missing @return tag in function comment
 167 | ERROR   | [ ] Missing short description in doc comment
 167 | ERROR   | [ ] Doc comment for parameter "$value" missing
 172 | ERROR   | [ ] Missing @return tag in function comment
 184 | ERROR   | [ ] Missing short description in doc comment
 184 | ERROR   | [ ] Doc comment for parameter "$value" missing
 186 | ERROR   | [ ] Missing @return tag in function comment
 196 | ERROR   | [ ] Missing short description in doc comment
 196 | ERROR   | [ ] Doc comment for parameter "$value" missing
 198 | ERROR   | [ ] Missing @return tag in function comment
 210 | ERROR   | [ ] Missing short description in doc comment
 210 | ERROR   | [ ] Doc comment for parameter "$collection" missing
 211 | ERROR   | [ ] Tag @internal cannot be grouped with parameter tags in a doc comment
 213 | ERROR   | [ ] Doc comment for parameter $style does not match actual variable name $collection
 213 | ERROR   | [x] Expected 22 spaces after parameter name; 1 found
 213 | ERROR   | [x] Tag value for @param tag indented incorrectly; expected 4 spaces but found 1
 213 | WARNING | [ ] Line exceeds 85 characters; contains 97 characters
 214 | ERROR   | [x] Expected 8 spaces after parameter type; 1 found
 214 | ERROR   | [ ] Doc comment for parameter $allowCollectionFormatMulti does not match actual variable name $style
 214 | ERROR   | [x] Tag value for @param tag indented incorrectly; expected 4 spaces but found 1
 214 | WARNING | [ ] Line exceeds 85 characters; contains 103 characters
 215 | ERROR   | [ ] Missing @return tag in function comment
 222 | WARNING | [ ] Line exceeds 85 characters; contains 97 characters
 233 | ERROR   | [ ] Missing short description in doc comment
 233 | ERROR   | [ ] Doc comment for parameter "$data" missing
 234 | ERROR   | [ ] Tag @internal cannot be grouped with parameter tags in a doc comment
 235 | ERROR   | [ ] Missing parameter comment
 235 | ERROR   | [ ] Doc comment for parameter $constraints does not match actual variable name $data
 235 | ERROR   | [x] Tag value for @param tag indented incorrectly; expected 4 spaces but found 1
 236 | ERROR   | [ ] Tag @throws cannot be grouped with parameter tags in a doc comment
 236 | ERROR   | [x] Tag value for @throws tag indented incorrectly; expected 3 spaces but found 1
 237 | ERROR   | [ ] Missing @return tag in function comment
 245 | ERROR   | [ ] Missing short description in doc comment
----------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 6 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------------------------------


FILE: /var/www/html/Infobip/SplFileObjectNormalizer.php
-------------------------------------------------------------------------------------------------------------------------
FOUND 33 ERRORS AND 11 WARNINGS AFFECTING 29 LINES
-------------------------------------------------------------------------------------------------------------------------
   8 | ERROR   | [ ] Content of the @author tag must be in the form "Display Name <[email protected]>"
  10 | WARNING | [ ] PHP version not specified
  10 | ERROR   | [ ] Missing @license tag in file comment
  17 | WARNING | [ ] Line exceeds 85 characters; contains 87 characters
  21 | WARNING | [ ] Line exceeds 85 characters; contains 215 characters
  23 | WARNING | [ ] Line exceeds 85 characters; contains 120 characters
  36 | ERROR   | [ ] Missing doc comment for class SplFileObjectNormalizer
  43 | ERROR   | [ ] Private member variable "defaultContext" must be prefixed with an underscore
  52 | ERROR   | [ ] Missing doc comment for function __construct()
  57 | ERROR   | [ ] Missing doc comment for function setDefaultContext()
  62 | ERROR   | [ ] Missing short description in doc comment
  62 | ERROR   | [ ] Doc comment for parameter "$object" missing
  62 | ERROR   | [ ] Doc comment for parameter "$format" missing
  62 | ERROR   | [ ] Doc comment for parameter "$context" missing
  64 | ERROR   | [x] Tag value for @throws tag indented incorrectly; expected 5 spaces but found 1
  65 | ERROR   | [ ] Missing @return tag in function comment
  66 | WARNING | [ ] Line exceeds 85 characters; contains 96 characters
  69 | WARNING | [ ] Line exceeds 85 characters; contains 98 characters
  75 | ERROR   | [ ] Missing short description in doc comment
  75 | ERROR   | [ ] Doc comment for parameter "$data" missing
  75 | ERROR   | [ ] Doc comment for parameter "$format" missing
  77 | ERROR   | [ ] Missing @return tag in function comment
  83 | ERROR   | [ ] Missing short description in doc comment
  83 | ERROR   | [ ] Doc comment for parameter "$type" missing
  83 | ERROR   | [ ] Doc comment for parameter "$format" missing
  83 | ERROR   | [ ] Doc comment for parameter "$context" missing
  84 | ERROR   | [ ] Tag @inheritdoc cannot be grouped with parameter tags in a doc comment
  85 | ERROR   | [ ] Missing parameter comment
  85 | ERROR   | [x] Tag value for @param tag indented incorrectly; expected 6 spaces but found 1
  86 | ERROR   | [ ] Tag @throws cannot be grouped with parameter tags in a doc comment
  86 | ERROR   | [x] Tag value for @throws tag indented incorrectly; expected 5 spaces but found 1
  87 | ERROR   | [ ] Missing @return tag in function comment
  88 | WARNING | [ ] Line exceeds 85 characters; contains 117 characters
 100 | WARNING | [ ] Line exceeds 85 characters; contains 101 characters
 107 | WARNING | [ ] Line exceeds 85 characters; contains 99 characters
 125 | ERROR   | [ ] Missing short description in doc comment
 125 | ERROR   | [ ] Doc comment for parameter "$data" missing
 125 | ERROR   | [ ] Doc comment for parameter "$type" missing
 125 | ERROR   | [ ] Doc comment for parameter "$format" missing
 127 | ERROR   | [ ] Missing @return tag in function comment
 128 | WARNING | [ ] Line exceeds 85 characters; contains 99 characters
 130 | WARNING | [ ] Line exceeds 85 characters; contains 91 characters
 133 | ERROR   | [ ] Missing doc comment for function sanitizeFilename()
 133 | ERROR   | [ ] Private method name "SplFileObjectNormalizer::sanitizeFilename" must be prefixed with an underscore
-------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------------

Class 'Configuration' not found

i keep getting this error "Class 'Configuration' not found" even after adding the path above like this
require DIR . "/to the path/vendor/autoload.php";

Bad request

am trying to send message to multiple destinations using php as in this example

https://dev.infobip.com/send-sms/single-sms-message

$to='["255717222303","255743475944"]';
sample codes am using

curl_setopt_array($curl, array( CURLOPT_URL => "https://api.infobip.com/sms/1/text/single", CURLOPT_SSL_VERIFYHOST=>0, CURLOPT_SSL_VERIFYPEER=>0, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => "{ \"from\":\"{from}\", \"to\":{$to}, \"text\":\"{$message}\" }", CURLOPT_HTTPHEADER => array( "accept: application/json", "authorization: Basic {$auth}", "content-type: application/json" ), ));

Does that example work?

Regards

More detailed changelogs or upgrade guides.

@ib-fsrnec can we possibly get more detailed changelogs or upgrade guides 5.0.0 and future major releases?
The changelog simply says there are breaking changes then just links to the documentation. This is not very helpful.

error installing composer

Command: composer install

Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

Problem 1
- The requested package infobip-api-php-client could not be found in any version, there may be a typo in the package name.

Potential causes:

Read https://getcomposer.org/doc/articles/troubleshooting.md for further common problems.

C:\xampp\htdocs\api_sms>

[InvalidArgumentException] Could not find a version of package aryelds/yii2-sweet-alert matching your minimum-stability (stable). Require it with an explicit version constraint allowing its desired stability.

Hi,
I have received this error. while using composer require
composer require aryelds/yii2-sweet-alert

[InvalidArgumentException]
Could not find a version of package aryelds/yii2-sweet-alert matching your
minimum-stability (stable). Require it with an explicit version constraint
allowing its desired stability.

I tried this to composer update,
but error,

  • Installation request for aryelds/yii2-sweet-alert @dev -> satisfiable by aryelds/yii2-sweet-alert[dev-master].
    • aryelds/yii2-sweet-alert dev-master requires bower-asset/sweetalert 1.1.3 -> no matching package found.

Allow to use a proxy

It seems that currently, we can't use a proxy with this lib, so we had to fork it a long time ago. Allowing to set it through the curl opt (CURLOPT_PROXY) could be a good start !

I could try to make a PR if you'd like.

Thanks.

Failing PHP Unit

$ ddev composer unit
> ./vendor/bin/phpunit test
PHPUnit 9.6.8 by Sebastian Bergmann and contributors.

...EEE.............                                               19 / 19 (100%)

Time: 00:00.109, Memory: 4.00 MB

There were 3 errors:

1) Infobip\Test\ObjectSerializerTest::testSimpleSerialization
Error: Class "Infobip\Test\SimpleModel" not found

/var/www/html/test/ObjectSerializerTest.php:27

2) Infobip\Test\ObjectSerializerTest::testSimpleDeserialization
Symfony\Component\Serializer\Exception\NotNormalizableValueException: Could not denormalize object of type "Infobip\Test\SimpleModel", no supporting normalizer found.

/var/www/html/vendor/symfony/serializer/Serializer.php:223
/var/www/html/vendor/symfony/serializer/Serializer.php:151
/var/www/html/Infobip/ObjectSerializer.php:118
/var/www/html/test/ObjectSerializerTest.php:63

3) Infobip\Test\ObjectSerializerTest::testValidation
Error: Class "Infobip\Test\SimpleModelWithValidations" not found

/var/www/html/test/ObjectSerializerTest.php:72

ERRORS!
Tests: 19, Assertions: 28, Errors: 3.
Script ./vendor/bin/phpunit test handling the unit event returned with error code 2

account not provisioned for global one- or two-way sms (code 592)

Hi there. I use the infobip API for sending sms. During my sending tests, I used a Swiss number as the recipient and this is the message I received: "account not provisioned for global one- or two-way sms (code 592)". Could someone explain the problem to me? Thanks

REJECTED_SOURCE

Message ID: c97**cc56 Receiver: 25****20 Message status: REJECTED_SOURCE.

I get the above error, please help figure out why

Integration with Laravel

Hello,

Am glad i found the API, Can you please help me integrate it with Laravel? I have tried all invain, Please, your help will be so appreciated.

Send issue

I try to send a multiple sms with SendMultipleTextualSmsAdvanced client and SMSAdvancedTextualRequest but i received this
Exception in AbstractApiClient.php line 124:
{"requestError":{"serviceException":{"messageId":"BAD_REQUEST","text":"Bad request"}}}

I was only able to send with SendSingleTextualSms in 1 number..
But i need the SendMultipleTextualSmsAdvanced,SendMultipleSmsBinaryAdvanced in order to cover all sms types(text,binary,flash,wap)!

Issue with sending

I have two issues.
when i send a schedule sms..(except the fact that id doesnt work if i put Datetime object in sendAt() function but only if i put tha date as atomstring format as i use Carbon for this!)
Then It sends normally the sms and i receive pending status..when it comes the time to send everytime, i receive this status! Why do i receive this?
groupName: REJECTED
groupId: 5
name: REJECTED_DESTINATION_NOT_REGISTERED
description: Destination not registered
statusId: 18

Also there is one more issue with wap;
when i sent the sms as wap i receive this status
groupId:1
groupName: PENDING
name: PENDING_ENROUTE
descriptions: Message sent to next instance
statusId: 7

but after i few it changes to this status

groupName: UNDELIVERABLE
groupId: 2
name: UNDELIVERABLE_REJECTED_OPERATOR
description: Message rejected by operator
statusId: 4

why does this happen?
Also i receive push sms as normal text sms(the same with flash sms) and i set correctly the required fields

Send multiple messages to multiple numbers

wanted to find out, if its possible to pass an array to setText() on the Message Class when sending to multiple number so the first number receives the first message in the message array..

if not possible, how do i implement this since its in your http api docs

Class GetAccountBalance not found

Hi,

I've try to initializing get account balance, but i can't success. because getting the below error:

Fatal error: Class 'infobip\api\client\GetAccountBalance' not found

The code:

try {
	$client = new infobip\api\client\GetAccountBalance( new infobip\api\configuration\BasicAuthConfiguration( 'username', 'password' ) );
} catch ( Exception $e ) {
	return $e->getMessage();
}

ObjectSerializer::sanitizeForSerialization undefined method call

When I copy paste your example from the interactive IDE https://tryapi.infobip.com/send-sms-php-lib which is using the SmsAdvancedTextualRequest into my project I get this undefined method call on the ObjectSerializer error, and when you go to that class there is truly no method with that name defined.

This is the part that triggers the error in SendSmsApi

  // for model (json/xml)
  if (isset($smsAdvancedTextualRequest)) {
        if ($headers['Content-Type'] === 'application/json') {
            $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($smsAdvancedTextualRequest));
        } else {
            $httpBody = $smsAdvancedTextualRequest;
        }
   ....     

Looks like this method was present in version 4.0 https://github.com/infobip/infobip-api-php-client/blob/4.0.0/Infobip/ObjectSerializer.php and it got removed in 5.0.

My environment is:
PHP 8.2
Symfony 6.2
Dockerized in PHP-FPM alpine image
Infobip client version 5.0

===========
UPDATE:

All of these method calls will cause the undefined error as well, they are just a couple of lines bellow in the same class, looks like you removed them from the Configuration object:

// this endpoint requires API key authentication
        $apiKey = $this->config->getApiKeyWithPrefix('Authorization');
        if ($apiKey !== null) {
            $headers['Authorization'] = $apiKey;
        }
        // this endpoint requires HTTP basic authentication
        if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) {
            $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword());
        }
        // this endpoint requires API key authentication
        $apiKey = $this->config->getApiKeyWithPrefix('Authorization');
        if ($apiKey !== null) {
            $headers['Authorization'] = $apiKey;
        }
        // this endpoint requires OAuth (access token)
        if (!empty($this->config->getAccessToken())) {
            $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken();
        }

bug: client and api discrepency

The API documentation lists the WhatsApp template categories as MARKETING, AUTHENTICATION, UTILITY
Screenshot from 2023-05-10 14-51-32

but https://github.com/infobip/infobip-api-php-client/releases/tag/5.0.0 only allows the old categories of MARKETING, TRANSACTIONAL, OTP
image

The error I get if I try to create a template with the UTILITY category

Property path 'category' validation failed with message: The value you selected is not a valid choice. {"userId":1,"exception":"[object] (InvalidArgumentException(code: 0): Property path 'category' validation failed with message: The value you selected is not a valid choice. at /var/www/html/vendor/infobip/infobip-api-php-client/Infobip/ObjectSerializer.php:256)

Failing PHP Stan

As far as I'm informed, PHP Stan is the default for static code analysis of PHP codebases. We have +100 errors on level 3 of the analysis

$ ddev composer bugs
> ./vendor/bin/phpstan analyse -l 3 Infobip
 462/462 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

 ------- -----------------------------------------------------------------------------------------
  Line    Api/CallsApi.php
 ------- -----------------------------------------------------------------------------------------
  226     Variable $callsAddExistingCallRequest in isset() always exists and is not nullable.
  517     Variable $callsAddNewCallRequest in isset() always exists and is not nullable.
  808     Variable $callsAnswerRequest in isset() always exists and is not nullable.
  1099    Variable $callsApplicationTransferRequest in isset() always exists and is not nullable.
  1402    Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  1698    Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  1982    Variable $callsDtmfCaptureRequest in isset() always exists and is not nullable.
  2273    Variable $callsPlayRequest in isset() always exists and is not nullable.
  2564    Variable $callsSayRequest in isset() always exists and is not nullable.
  2855    Variable $callsDtmfSendRequest in isset() always exists and is not nullable.
  3146    Variable $callsRecordingStartRequest in isset() always exists and is not nullable.
  3433    Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  3702    Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  3982    Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  4255    Variable $callsOnDemandComposition in isset() always exists and is not nullable.
  4535    Variable $callsOnDemandComposition in isset() always exists and is not nullable.
  4815    Variable $callsPlayRequest in isset() always exists and is not nullable.
  5106    Variable $callsSayRequest in isset() always exists and is not nullable.
  5397    Variable $callsStartRecordingRequest in isset() always exists and is not nullable.
  5684    Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  5953    Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  6221    Variable $callsConnectRequest in isset() always exists and is not nullable.
  6512    Variable $callsConnectWithNewCallRequest in isset() always exists and is not nullable.
  6787    Variable $callBulkRequest in isset() always exists and is not nullable.
  7062    Variable $callRequest in isset() always exists and is not nullable.
  7337    Variable $callsConferenceRequest in isset() always exists and is not nullable.
  7612    Variable $callsDialogRequest in isset() always exists and is not nullable.
  7887    Variable $callsMediaStreamConfigRequest in isset() always exists and is not nullable.
  8163    Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  8432    Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  8690    Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  8959    Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  9228    Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  9497    Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  9770    Variable $callsDialogPlayRequest in isset() always exists and is not nullable.
  10061   Variable $callsDialogSayRequest in isset() always exists and is not nullable.
  10352   Variable $callsDialogRecordingRequest in isset() always exists and is not nullable.
  10639   Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  10908   Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  11188   Offset 'Content-Type' does not exist on array{Accept: 'application/octet…'}.
  11457   Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  11726   Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  11995   Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  12264   Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  12644   Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  12913   Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  13191   Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  13582   Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  13939   Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  14208   Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  14477   Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  14746   Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  15068   Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  15401   Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  15756   Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  16025   Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  16294   Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  16563   Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  16897   Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  17242   Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  17586   Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  17855   Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  18133   Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  18406   Variable $callsHangupRequest in isset() always exists and is not nullable.
  18693   Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  18962   Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  19231   Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  19500   Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  19785   Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  20058   Variable $callsRescheduleRequest in isset() always exists and is not nullable.
  20334   Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  20603   Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  20876   Variable $callsStartMediaStreamRequest in isset() always exists and is not nullable.
  21163   Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  21447   Variable $callsUpdateRequest in isset() always exists and is not nullable.
  21754   Variable $callsUpdateRequest in isset() always exists and is not nullable.
  22045   Variable $callsMediaStreamConfigRequest in isset() always exists and is not nullable.
 ------- -----------------------------------------------------------------------------------------

 ------ -------------------------------------------------------------------------------------
  Line   Api/ClickToCallApi.php
 ------ -------------------------------------------------------------------------------------
  194    Variable $callsClickToCallMessageBody in isset() always exists and is not nullable.
 ------ -------------------------------------------------------------------------------------

 ------ ----------------------------------------------------------------------------------------------------------------
  Line   Api/EmailApi.php
 ------ ----------------------------------------------------------------------------------------------------------------
  194    Variable $emailAddDomainRequest in isset() always exists and is not nullable.
  469    Variable $emailDomainIpRequest in isset() always exists and is not nullable.
  618    Method Infobip\Api\EmailApi::deleteDomain() with return type void returns null but should not return anything.
  723    Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  974    Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  1219   Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  1461   Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  1697   Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  1972   Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  2302   Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  2534   Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  2755   Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  2988   Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  3235   Variable $emailBulkRescheduleRequest in isset() always exists and is not nullable.
  4030   Variable $emailBulkUpdateStatusRequest in isset() always exists and is not nullable.
  4266   Variable $emailTrackingEventRequest in isset() always exists and is not nullable.
  4530   Variable $emailValidationRequest in isset() always exists and is not nullable.
  4679   Method Infobip\Api\EmailApi::verifyDomain() with return type void returns null but should not return anything.
  4784   Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
 ------ ----------------------------------------------------------------------------------------------------------------

 ------ ----------------------------------------------------------------------------
  Line   Api/MmsApi.php
 ------ ----------------------------------------------------------------------------
  201    Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  443    Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  656    Variable $mmsAdvancedRequest in isset() always exists and is not nullable.
  944    Variable $body in isset() always exists and is not nullable.
 ------ ----------------------------------------------------------------------------

 ------ -----------------------------------------------------------------------------------
  Line   Api/SmsApi.php
 ------ -----------------------------------------------------------------------------------
  201    Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  471    Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  812    Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  1060   Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  1308   Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  1554   Variable $smsPreviewRequest in isset() always exists and is not nullable.
  1808   Variable $smsBulkRequest in isset() always exists and is not nullable.
  2055   Variable $smsAdvancedBinaryRequest in isset() always exists and is not nullable.
  2297   Variable $smsAdvancedTextualRequest in isset() always exists and is not nullable.
  2551   Variable $smsUpdateStatusRequest in isset() always exists and is not nullable.
 ------ -----------------------------------------------------------------------------------

 ------ ---------------------------------------------------------------------------------------
  Line   Api/TfaApi.php
 ------ ---------------------------------------------------------------------------------------
  194    Variable $tfaApplicationRequest in isset() always exists and is not nullable.
  457    Variable $tfaCreateMessageRequest in isset() always exists and is not nullable.
  716    Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  952    Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  1220   Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  1472   Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  1758   Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  2014   Variable $tfaResendPinRequest in isset() always exists and is not nullable.
  2277   Variable $tfaResendPinRequest in isset() always exists and is not nullable.
  2535   Variable $tfaStartAuthenticationRequest in isset() always exists and is not nullable.
  2782   Variable $tfaStartAuthenticationRequest in isset() always exists and is not nullable.
  3045   Variable $tfaApplicationRequest in isset() always exists and is not nullable.
  3324   Variable $tfaUpdateMessageRequest in isset() always exists and is not nullable.
  3587   Variable $tfaVerifyPinRequest in isset() always exists and is not nullable.
 ------ ---------------------------------------------------------------------------------------

 ------ ------------------------------------------------------------------------------
  Line   Api/ViberApi.php
 ------ ------------------------------------------------------------------------------
  194    Variable $viberFileMessage in isset() always exists and is not nullable.
  458    Variable $viberImageMessage in isset() always exists and is not nullable.
  722    Variable $viberBulkTextMessage in isset() always exists and is not nullable.
  986    Variable $viberVideoMessage in isset() always exists and is not nullable.
 ------ ------------------------------------------------------------------------------

 ------ ----------------------------------------------------------------------------------
  Line   Api/VoiceApi.php
 ------ ----------------------------------------------------------------------------------
  202    Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  450    Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  702    Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  954    Variable $callsUpdateStatusRequest in isset() always exists and is not nullable.
  1213   Variable $callsBulkRequest in isset() always exists and is not nullable.
  1460   Variable $callsAdvancedBody in isset() always exists and is not nullable.
  1707   Variable $callsMultiBody in isset() always exists and is not nullable.
  1954   Variable $callsSingleBody in isset() always exists and is not nullable.
 ------ ----------------------------------------------------------------------------------

 ------ ------------------------------------------------------------------------------------------------------------------
  Line   Api/WebRtcApi.php
 ------ ------------------------------------------------------------------------------------------------------------------
  101    Method Infobip\Api\WebRtcApi::deletePushConfiguration() with return type void returns null but should not return
         anything.
  206    Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  438    Variable $webRtcTokenRequestModel in isset() always exists and is not nullable.
  670    Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  939    Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  1185   Variable $webRtcPushConfigurationRequest in isset() always exists and is not nullable.
  1443   Variable $webRtcPushConfigurationRequest in isset() always exists and is not nullable.
 ------ ------------------------------------------------------------------------------------------------------------------

 ------ ----------------------------------------------------------------------------------------------------------------------
  Line   Api/WhatsAppApi.php
 ------ ----------------------------------------------------------------------------------------------------------------------
  103    Method Infobip\Api\WhatsAppApi::confirmWhatsAppIdentity() with return type void returns null but should not return
         anything.
  226    Variable $whatsAppIdentityConfirmation in isset() always exists and is not nullable.
  481    Variable $whatsAppTemplatePublicApiRequest in isset() always exists and is not nullable.
  653    Method Infobip\Api\WhatsAppApi::deleteWhatsAppMedia() with return type void returns null but should not return
         anything.
  761    Variable $whatsAppUrlDeletionRequest in isset() always exists and is not nullable.
  886    Method Infobip\Api\WhatsAppApi::deleteWhatsAppTemplate() with return type void returns null but should not return
         anything.
  1006   Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  1288   Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  1529   Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  1672   Method Infobip\Api\WhatsAppApi::getWhatsAppMediaMetadata() with return type void returns null but should not return
         anything.
  1792   Offset 'Content-Type' does not exist on array{}.
  2014   Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  2168   Method Infobip\Api\WhatsAppApi::markWhatsAppMessageAsRead() with return type void returns null but should not return
         anything.
  2288   Offset 'Content-Type' does not exist on array{Accept: 'application/json'}.
  2509   Variable $whatsAppAudioMessage in isset() always exists and is not nullable.
  2762   Variable $whatsAppContactsMessage in isset() always exists and is not nullable.
  3015   Variable $whatsAppDocumentMessage in isset() always exists and is not nullable.
  3268   Variable $whatsAppImageMessage in isset() always exists and is not nullable.
  3521   Variable $whatsAppInteractiveButtonsMessage in isset() always exists and is not nullable.
  3774   Variable $whatsAppInteractiveListMessage in isset() always exists and is not nullable.
  4027   Variable $whatsAppInteractiveMultiProductMessage in isset() always exists and is not nullable.
  4280   Variable $whatsAppInteractiveProductMessage in isset() always exists and is not nullable.
  4533   Variable $whatsAppLocationMessage in isset() always exists and is not nullable.
  4786   Variable $whatsAppStickerMessage in isset() always exists and is not nullable.
  5039   Variable $whatsAppBulkMessage in isset() always exists and is not nullable.
  5292   Variable $whatsAppTextMessage in isset() always exists and is not nullable.
  5545   Variable $whatsAppVideoMessage in isset() always exists and is not nullable.
 ------ ----------------------------------------------------------------------------------------------------------------------

 ------ -------------------------------------------------------------------------------------------------------------------
  Line   Model/CallsTimeWindow.php
 ------ -------------------------------------------------------------------------------------------------------------------
  41     PHPDoc tag @param for parameter $days with type array<string> is incompatible with native type string.
  42     PHPDoc type for property Infobip\Model\CallsTimeWindow::$days with type array<string> is incompatible with native
         type string.
  94     Method Infobip\Model\CallsTimeWindow::getDays() should return array<string> but returns string.
  102    Property Infobip\Model\CallsTimeWindow::$days (string) does not accept array<string>.
 ------ -------------------------------------------------------------------------------------------------------------------

 ------ -----------------------------------------------------------------------------------------
  Line   Model/EmailAddDomainRequest.php
 ------ -----------------------------------------------------------------------------------------
  47     Access to undefined constant Infobip\Model\EmailAddDomainRequest::DKIM_KEY_LENGTH_2048.
 ------ -----------------------------------------------------------------------------------------

 ------ ----------------------------------------------------------------------------------------------
  Line   ObjectSerializer.php
 ------ ----------------------------------------------------------------------------------------------
  126    Call to an undefined method Symfony\Component\Serializer\SerializerInterface::normalize().
  138    Call to an undefined method Symfony\Component\Serializer\SerializerInterface::denormalize().
  202    Call to an undefined method Symfony\Component\Serializer\SerializerInterface::normalize().
 ------ ----------------------------------------------------------------------------------------------

Depracated Dependency breaking SMS capability

I am unable to use the SmsApi due to the libraries dependencies being depracated. In particular, the AnnotationLoader.
When I try to use it I get an error that states: "Since symfony/serializer 6.4: The "Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader" class is deprecated, use "Symfony\Component\Serializer\Mapping\Loader\AttributeLoader" instead."

This is making this entire library completely unusable for us. Please update this.

Voice API?

Is the way to send Speech2Voice via this PHP package?

Could not denormalize object of type "object", no supporting normalizer found.

All of a sudden we started receiving these errors from your API method.
We haven't changed anything that I'm aware of that might cause this issue, but I'm ready to investigate.

Could not denormalize object of type "object", no supporting normalizer found.
File: /var/www/vendor/symfony/serializer/Serializer.php
Line: 211

We are using ViberImageMessage as an object that we are passing to sendViberImageMessage method of Infobip\Api\ViberApi;

Here's how it looks:

$recipient = str_replace('+', '', $recipient);
$viberMessageText = $data->viberMessageText;
$viberImgUrl = $data->viberImgUrl;
$viberButtonText = $data->viberButtonText;
$viberButtonLink = $data->viberButtonLink;
$smsFailoverText = $data->smsFailoverText;

$viberApi = new ViberApi($this->configuration);
$viberSmsFailover = new ViberSmsFailover($this->defaultSender, $smsFailoverText);
$viberButton = new ViberButton($viberButtonText, $viberButtonLink);
$viberImageContent = new ViberImageContent($viberImgUrl, $viberMessageText, $viberButton);
$viberImageMessage = new ViberImageMessage(
    $this->defaultSender,
    $recipient,
    $viberImageContent,
    null, null, null, null, null,
    $viberSmsFailover
);

$viberApi->sendViberImageMessage($viberImageMessage);

The code was intact for more than several weeks, but this error started occurring last Thursday. It may be that there is something wrong underneath with dependencies, since the error comes from the Seralizer, but I have no clue what is going on, and how to dig deeper and debug your library.

Any help would be appreciated since we rely a lot on these Viber messages. Thanks for the understanding.


UPDATE

Ok, I actually managed to dig deeper into this library and debug and find out where the error comes from.

Error is happening at Infobip\ObjectSerializer on line 119 (method deserialize).

What happes is that GuzzleHttp returns a HTTP error 500, and then your code throws new ApiException, which gets caught and calls sendViberImageMessageApiException, which further tries to deserialize the HTTP response, but fails at telling the ObjectSerializer the correct class name, which ends at symfony/serializer who knows nothing about the class name "object"

So, this is the actual error I get from your API (yes, I will contact the support):

{"requestError":{"serviceException":{"messageId":"GENERAL_ERROR","text":"Something went wrong. Please contact support."}}}

But this is the problem in this library that causes the original error I reported:

image

It should be of type stdClass instead of object.

If I'm not mistaking anything, I can make a PR for this.

Cheers!

Laravel 5.1 instalation

Hi.

i try to install in my laravel 5.1 project via: "composer require infobip/infobip-api-php-client" but that not works, [InvalidArgumentException]
Could not find package infobip/infobip-api-php-client at any version for your minimum-stability (stable). Check the package spelling or your minimum-stability

Found an error

Fatal error: Uncaught RuntimeException: SSL certificate problem: unable to get local issuer certificate in G:\webs\htdocs\smart\vendor\infobip\infobip-api-php-client\infobip\api\AbstractApiClient.php:118 Stack trace: #0 G:\webs\htdocs\smart\vendor\infobip\infobip-api-php-client\infobip\api\AbstractApiClient.php(23): infobip\api\AbstractApiClient->executeRequest('GET', 'https://api.inf...', Array) #1 G:\webs\htdocs\smart\vendor\infobip\infobip-api-php-client\infobip\api\client\GetAccountBalance.php(22): infobip\api\AbstractApiClient->executeGET('https://api.inf...', NULL) #2 G:\webs\htdocs\smart\sms.php(8): infobip\api\client\GetAccountBalance->execute() #3 {main} thrown in G:\webs\htdocs\smart\vendor\infobip\infobip-api-php-client\infobip\api\AbstractApiClient.php on line 118

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.