PHPackages                             infobip/infobip-api-php-client - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. infobip/infobip-api-php-client

ActiveLibrary[HTTP &amp; Networking](/categories/http)

infobip/infobip-api-php-client
==============================

PHP library for consuming Infobip's API

6.2.1(1y ago)921.8M↓10.6%73[6 issues](https://github.com/infobip/infobip-api-php-client/issues)10MITPHPPHP &gt;=8.3

Since Nov 18Pushed 1mo ago15 watchersCompare

[ Source](https://github.com/infobip/infobip-api-php-client)[ Packagist](https://packagist.org/packages/infobip/infobip-api-php-client)[ Docs](https://www.infobip.com)[ RSS](/packages/infobip-infobip-api-php-client/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (10)Versions (28)Used By (10)

Infobip API PHP Client
======================

[](#infobip-api-php-client)

[![Packagist](https://camo.githubusercontent.com/e6a836dacc6fcdca126fcc09339d541f0e4573fec834ff2eaae4bb8ec8d15042/68747470733a2f2f62616467656e2e6e65742f7061636b61676973742f762f696e666f6269702f696e666f6269702d6170692d7068702d636c69656e74)](https://packagist.org/packages/infobip/infobip-api-php-client)[![Snyk](https://camo.githubusercontent.com/7eb5f839a301ddce72538e7e44c1254fad9c364910d3820aa664d57d5b78e162/68747470733a2f2f736e796b2e696f2f746573742f6769746875622f696e666f6269702f696e666f6269702d6170692d7068702d636c69656e742f62616467652e737667)](https://snyk.io/test/github/infobip/infobip-api-php-client)[![MIT License](https://camo.githubusercontent.com/be83dfb422b5ff2739afb59cf20b3db049ebfacf938f74160bf58b1b13d60bf1/68747470733a2f2f62616467656e2e6e65742f6769746875622f6c6963656e73652f696e666f6269702f696e666f6269702d6170692d7068702d636c69656e74)](https://opensource.org/licenses/MIT)

This is a PHP Client for Infobip API and you can use it as a dependency to add [Infobip APIs](https://www.infobip.com/docs/api) to your application. To use this, you'll need an Infobip account. If not already having one, you can create a [free trial](https://www.infobip.com/docs/essentials/free-trial) account [here](https://www.infobip.com/signup).

`infobip-api-php-client` is built on top of [OpenAPI Specification](https://spec.openapis.org/oas/latest.html), generated by [Infobip OSCAR](https://www.youtube.com/watch?v=XC8oVn_efTw) service powered by [OpenAPI Generator](https://openapi-generator.tech/).

[![Infobip](https://camo.githubusercontent.com/dad543469504a09843380e4a5c5c9e38fc17ff3a6f22180b879e626913b76a95/68747470733a2f2f7564657369676e6373732e636f6d2f77702d636f6e74656e742f75706c6f6164732f323032302f30312f496e666f6269702d6c6f676f2d7472616e73706172656e742e706e67)](https://camo.githubusercontent.com/dad543469504a09843380e4a5c5c9e38fc17ff3a6f22180b879e626913b76a95/68747470733a2f2f7564657369676e6373732e636f6d2f77702d636f6e74656e742f75706c6f6164732f323032302f30312f496e666f6269702d6c6f676f2d7472616e73706172656e742e706e67)

#### Table of contents:

[](#table-of-contents)

- [Documentation](#documentation)
- [General Info](#general-info)
- [Installation](#installation)
- [Quickstart](#quickstart)
- [Ask for help](#ask-for-help)

Documentation
-------------

[](#documentation)

Detailed documentation about Infobip API can be found [here](https://www.infobip.com/docs/api). The current version of this library includes this subset of Infobip products:

- [SMS](https://www.infobip.com/docs/api/channels/sms)
- [2FA](https://www.infobip.com/docs/api/platform/2fa)
- [Messages API](https://www.infobip.com/docs/api/platform/messages-api)
- [MMS](https://www.infobip.com/docs/api/channels/mms)
- [Voice](https://www.infobip.com/docs/api/channels/voice)
- [WebRTC](https://www.infobip.com/docs/api/channels/webrtc)
- [Email](https://www.infobip.com/docs/api/channels/email)
- [WhatsApp](https://www.infobip.com/docs/api/channels/whatsapp)
- [Viber](https://www.infobip.com/docs/api/channels/viber)
- [Moments](https://www.infobip.com/docs/api/customer-engagement/moments)

General Info
------------

[](#general-info)

For `infobip-api-php-client` versioning we use [Semantic Versioning](https://semver.org) scheme.

Published under [MIT License](LICENSE).

The library requires PHP version &gt;= 8.3.

Installation
------------

[](#installation)

#### Using Composer

[](#using-composer)

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

```
"require": {
	"infobip/infobip-api-php-client": "6.2.1"
}
```

And simply run `composer install` to download dependencies.

#### Without Composer

[](#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](https://php-download.com/package/infobip/infobip-api-php-client), download it from there and use in your project without manually collecting the dependencies.

Quickstart
----------

[](#quickstart)

#### Initialize the Configuration &amp; HTTP client

[](#initialize-the-configuration--http-client)

The library supports the [API Key Header](https://www.infobip.com/docs/essentials/api-authentication#api-key-header) authentication method. Once you have an [Infobip account](https://www.infobip.com/signup), you can manage your API keys through the Infobip [API key management](https://portal.infobip.com/settings/accounts/api-keys) page.

To see your base URL, log in to the [Infobip API Resource](https://www.infobip.com/docs/api) hub with your Infobip credentials or visit your [Infobip account](https://portal.infobip.com/homepage/).

```
    use Infobip\Configuration;

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

#### Send an SMS

[](#send-an-sms)

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

```
        use Infobip\ApiException;
        use Infobip\Model\SmsRequest;
        use Infobip\Model\SmsDestination;
        use Infobip\Model\SmsMessage;
        use Infobip\Api\SmsApi;
        use Infobip\Model\SmsTextContent;

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

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

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

        try {
            $smsResponse = $sendSmsApi->sendSmsMessages($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

[](#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 `webhooks.delivery.url` field of your request, or subscribe for reports by contacting our support team at . You can use data models from the library and the pre-configured `Infobip\ObjectSerializer` serializer.

Example of webhook implementation:

```
        use Infobip\Model\SmsDeliveryResult;
        use Infobip\ObjectSerializer;

        $objectSerializer = new ObjectSerializer();

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

        /**
        * @var SmsDeliveryResult $deliveryResult
        */
        $deliveryResult = $objectSerializer->deserialize($data, SmsDeliveryResult::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](https://www.infobip.com/docs/essentials/integration-best-practices#date-formats).

#### Fetching delivery reports

[](#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](https://www.infobip.com/docs/api/channels/sms/sms-messaging/logs-and-status-reports/get-outbound-sms-message-delivery-reports) 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 &amp; SMS preview

[](#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

[](#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](https://www.infobip.com/docs/api#channels/sms/receive-inbound-sms-messages). 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)

[](#two-factor-authentication-2fa)

For the 2FA quick start guide please check [these examples](two-factor-authentication.md).

#### Send email

[](#send-email)

For the send email quick start guide please check [these examples](email.md).

#### WhatsApp

[](#whatsapp)

For the WhatsApp quick start guide, view [these examples](whatsapp.md).

#### Messages API

[](#messages-api)

For the Messages API quick start guide, view [these examples](messages-api.md).

#### Moments

[](#moments)

For the Moments quick start guide, view [these examples](moments.md).

Versioning
----------

[](#versioning)

This project follows a pragmatic Semantic Versioning approach.
For full details on how versions are managed, please see our [Versioning guide](VERSIONING.md).

Ask for help
------------

[](#ask-for-help)

Feel free to open an issue on the repository if you see any problem or want to request a feature. As per pull requests, for details check the `CONTRIBUTING` [file](CONTRIBUTING.md) 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](CONTRIBUTING.md).

For anything that requires our immediate attention, contact us @ .

###  Health Score

66

—

FairBetter than 99% of packages

Maintenance68

Regular maintenance activity

Popularity58

Moderate usage in the ecosystem

Community35

Small or concentrated contributor base

Maturity88

Battle-tested with a long release history

 Bus Factor3

3 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~197 days

Recently: every ~146 days

Total

18

Last Release

479d ago

Major Versions

1.1.0 → 2.0.02016-09-30

2.5.0 → 3.0.02021-03-25

3.2.0 → 4.0.02022-10-21

4.0.0 → 5.0.02023-03-02

5.1.4 → 6.0.02024-12-09

PHP version history (3 changes)3.0.0PHP &gt;=7.2

4.0.0PHP &gt;=8.0

6.0.0PHP &gt;=8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/f07ad129e0f3750dc7928ebea23d6af60bc66caec94ec4d6b9e3a1ba9767f6e8?d=identicon)[infobip](/maintainers/infobip)

---

Top Contributors

[![hkozacinski-ib](https://avatars.githubusercontent.com/u/21356747?v=4)](https://github.com/hkozacinski-ib "hkozacinski-ib (8 commits)")[![ibirogar](https://avatars.githubusercontent.com/u/100855997?v=4)](https://github.com/ibirogar "ibirogar (6 commits)")[![nmenkovic-ib](https://avatars.githubusercontent.com/u/6659468?v=4)](https://github.com/nmenkovic-ib "nmenkovic-ib (5 commits)")[![josipk-ib](https://avatars.githubusercontent.com/u/73174428?v=4)](https://github.com/josipk-ib "josipk-ib (5 commits)")[![ib-fsrnec](https://avatars.githubusercontent.com/u/60620968?v=4)](https://github.com/ib-fsrnec "ib-fsrnec (4 commits)")[![dario-ib](https://avatars.githubusercontent.com/u/55133042?v=4)](https://github.com/dario-ib "dario-ib (3 commits)")[![pducic](https://avatars.githubusercontent.com/u/1651206?v=4)](https://github.com/pducic "pducic (2 commits)")[![ib-tjuhasz](https://avatars.githubusercontent.com/u/137774833?v=4)](https://github.com/ib-tjuhasz "ib-tjuhasz (1 commits)")[![dzubchik](https://avatars.githubusercontent.com/u/2685761?v=4)](https://github.com/dzubchik "dzubchik (1 commits)")[![lvukadinovic-ib](https://avatars.githubusercontent.com/u/138505157?v=4)](https://github.com/lvukadinovic-ib "lvukadinovic-ib (1 commits)")[![denis-cutic](https://avatars.githubusercontent.com/u/5920493?v=4)](https://github.com/denis-cutic "denis-cutic (1 commits)")

---

Tags

phpapisdkrestopenapiemail2fasmsmessagingwhatsappInfobiptfamsisdncallsviber

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/infobip-infobip-api-php-client/health.svg)

```
[![Health](https://phpackages.com/badges/infobip-infobip-api-php-client/health.svg)](https://phpackages.com/packages/infobip-infobip-api-php-client)
```

###  Alternatives

[api-platform/serializer

API Platform core Serializer

223.4M31](/packages/api-platform-serializer)[hostinger/api-php-sdk

Hostinger API PHP SDK

252.1k](/packages/hostinger-api-php-sdk)[ory/hydra-client-php

Documentation for all of Ory Hydra's APIs.

1710.8k](/packages/ory-hydra-client-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
