PHPackages                             zadquiel/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. [API Development](/categories/api)
4. /
5. zadquiel/infobip-api-php-client

ActiveLibrary[API Development](/categories/api)

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

Infobip SMS library for PHP Fixed Zadquiel

2.2.0(8y ago)047Apache-2.0PHP

Since Nov 18Pushed 8y ago1 watchersCompare

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

READMEChangelogDependencies (1)Versions (8)Used By (0)

Infobip API PHP client
======================

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

Prerequisites
-------------

[](#prerequisites)

- You have installed a [PHP interpreter](http://php.net/manual/en/install.php) (minimal required version is 5.5).
- You have installed [Composer](https://getcomposer.org/download).

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

[](#installation)

For using Infobip API PHP client in your project, you have to add the following to your `composer.json` file:

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

```

and run `composer install` command inside the project's root folder.

If your setup prevents you from using `composer` you can manually download this package and all of its dependencies and refference 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.

Running examples
----------------

[](#running-examples)

Before you start any of the examples, you have to populate specific data (sender address, receiver address, etc.) to `infobip/examples/examples.php` file.

Then, you should uncomment the example you want to test and run the PHP script with your **username** and **password** (in plain text) as arguments like the following:

```
php infobip/examples/examples.php YOUR_USERNAME YOUR_PASSWORD

```

### Basic messaging example

[](#basic-messaging-example)

The first thing that needs to be done is to include `autoload.php` and to initialize the messaging client:

```
require_once '/autoload.php';

$client = new infobip\api\client\SendSingleTextualSms(new infobip\api\configuration\BasicAuthConfiguration(USERNAME, PASSWORD));

```

You are basically logging in to Infobip, so an exception will be thrown if the username and/or password are incorrect.

The next step is to prepare the message:

```
$requestBody = new infobip\api\model\sms\mt\send\textual\SMSTextualRequest();
$requestBody->setFrom(FROM);
$requestBody->setTo(TO);
$requestBody->setText("This is an example message.");

```

Now you are ready to send the message:

```
$response = $client->execute($requestBody);

```

### Messaging with notification push example

[](#messaging-with-notification-push-example)

For sending SMS and expecting delivery report to be pushed to some notify URL, you have to initialize the messaging client:

```
$client = new infobip\api\client\SendMultipleTextualSmsAdvanced(new infobip\api\configuration\BasicAuthConfiguration(USERNAME, PASSWORD));

```

And prepare the advanced message:

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

$message = new infobip\api\model\sms\mt\send\Message();
$message->setFrom(FROM);
$message->setDestinations([$destination]);
$message->setText("This is an example message.");
$message->setNotifyUrl(NOTIFY_URL);

$requestBody = new infobip\api\model\sms\mt\send\textual\SMSAdvancedTextualRequest();
$requestBody->setMessages([$message]);

```

When the delivery notification is pushed to your server as a HTTP POST request, you could process body of the message with the following code:

```
$mapper = new JsonMapper();
$responseObject = $mapper->map(json_decode($responseBody), new infobip\api\model\sms\mt\reports\SMSReportResponse());

for ($i = 0; $i < count($responseObject->getResults()); ++$i) {
	$result = $responseObject->getResults()[$i];
	echo "Message ID: " . $result->getMessageId() . "\n";
	echo "Sent at: " . $result->getSentAt()->format('y-M-d H:m:s T') . "\n";
	echo "Receiver: " . $result->getTo() . "\n";
	echo "Status: " . $result->getStatus()->getName() . "\n";
	echo "Price: " . $result->getPrice()->getPricePerMessage() . " " . $result->getPrice()->getCurrency() . "\n\n";
}

```

### Sending message with special characters example

[](#sending-message-with-special-characters-example)

If you want to send message with special characters, this is how you initialize the client and prepare your message:

```
$client = new infobip\api\client\SendMultipleTextualSmsAdvanced(new infobip\api\configuration\BasicAuthConfiguration(USERNAME, PASSWORD));

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

$language = new infobip\api\model\sms\mt\send\Language();
//specific language code (TR stands for Turkish)
$language->setLanguageCode("TR");
//use single shift table for specific language ('false' or 'true')
$language->setSingleShift(true);
//use locking shift table for specific language ('false' or 'true')
$language->setLockingShift(false);

$message = new infobip\api\model\sms\mt\send\Message();
$message->setFrom(FROM);
$message->setDestinations([$destination]);
$message->setText("Artık Ulusal Dil Tanımlayıcısı ile Türkçe karakterli smslerinizi rahatlıkla iletebilirsiniz.");
$message->setLanguage($language);

$requestBody = new infobip\api\model\sms\mt\send\textual\SMSAdvancedTextualRequest();
$requestBody->setMessages([$message]);

```

Currently supported languages (with their language codes) are: `Spanish - "ES"`, `Portuguese - "PT"`, `Turkish - "TR"`.

### Number Context example

[](#number-context-example)

Initialize the number context query client:

```
$client = new infobip\api\client\NumberContextQuery(new infobip\api\configuration\BasicAuthConfiguration(USERNAME, PASSWORD));

```

Create request body:

```
$requestBody = new infobip\api\model\nc\query\NumberContextRequest();
$requestBody->setTo(TO);

```

Retrieve the number context:

```
$response = $client->execute($requestBody);

$numberContext = $response->getResults()[0];
echo "Phone number: " . $numberContext->getTo() . "\n";
echo "MccMnc: " . $numberContext->getMccMnc() . "\n";
echo "Original country prefix: " . $numberContext->getOriginalNetwork()->getCountryPrefix() . "\n";
echo "Original network prefix: " . $numberContext->getOriginalNetwork()->getNetworkPrefix() . "\n";
echo "Serving MSC: " . $numberContext->getServingMSC();

```

### Number Context with notification push example

[](#number-context-with-notification-push-example)

Similar to the previous example, but this time you must set the notification URL where the result will be pushed:

```
$client = new infobip\api\client\NumberContextNotify(new infobip\api\configuration\BasicAuthConfiguration(USERNAME, PASSWORD));

$requestBody = new infobip\api\model\nc\notify\NumberContextRequest();
$requestBody->setTo(TO);
$requestBody->setNotifyUrl(NOTIFY_URL);

$response = $client->execute($requestBody);

```

When the number context notification is pushed to your server as a HTTP POST request, you could process the body of the message with the following code:

```
$mapper = new JsonMapper();
$responseObject = $mapper->map(json_decode($responseBody), new infobip\api\model\nc\query\NumberContextResponse());

$numberContext = $responseObject->getResults()[0];
echo "Phone number: " . $numberContext->getTo() . "\n";
echo "MccMnc: " . $numberContext->getMccMnc() . "\n";
echo "Original country prefix: " . $numberContext->getOriginalNetwork()->getCountryPrefix() . "\n";
echo "Original network prefix: " . $numberContext->getOriginalNetwork()->getNetworkPrefix() . "\n";
echo "Status: " . $numberContext->getStatus()->getName();

```

### Retrieve inbound messages example

[](#retrieve-inbound-messages-example)

The client that has to be initialized is:

```
$client = new infobip\api\client\GetReceivedMessages(new infobip\api\configuration\BasicAuthConfiguration(USERNAME, PASSWORD));

```

Then you have to create execution context:

```
$context = new infobip\api\model\sms\mo\reports\GetReceivedMessagesExecuteContext;

```

If you want to filter inbound messages, you can do it by setting the value to any of execute context class fields.

The response type will be `\infobip\api\model\sms\mo\reports\MOReportResponse`:

```
$response = $client->execute($context);

for ($i = 0; $i < count($response->getResults()); ++$i) {
	$result = $response->getResults()[$i];
	echo "Message ID: " . $result->getMessageId() . "\n";
	echo "Received at: " . $result->getReceivedAt()->format('y-M-d H:m:s T') . "\n";
	echo "Sender: " . $result->getFrom() . "\n";
	echo "Receiver: " . $result->getTo() . "\n";
	echo "Message text: " . $result->getText() . "\n\n";
}

```

### Inbound message push example

[](#inbound-message-push-example)

The subscription to receive inbound messages can be set up on [Infobip](https://www.infobip.com) platform. When the inbound message notification is pushed to your server as a HTTP POST request, you could process body of the message with the following code:

```
$mapper = new JsonMapper();
$responseObject = $mapper->map(json_decode($responseBody), new infobip\api\model\sms\mo\reports\MOReportResponse());

$result = $responseObject->getResults()[0];
echo "Message ID: " . $result->getMessageId() . "\n";
echo "Received at: " . $result->getReceivedAt()->format('y-M-d H:m:s T') . "\n";
echo "Sender: " . $result->getFrom() . "\n";
echo "Receiver: " . $result->getTo() . "\n";
echo "Message text: " . $result->getText() . "\n";
echo "Keyword: " . $result->getKeyword() . "\n";
echo "Clean text: " . $result->getCleanText() . "\n";
echo "Sms count: " . $result->getSmsCount() . "\n";

```

License
-------

[](#license)

This library is licensed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0)

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 50% of commits — single point of failure

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 ~210 days

Total

5

Last Release

2989d ago

Major Versions

1.1.0 → 2.0.02016-09-30

### Community

Maintainers

![](https://www.gravatar.com/avatar/8a4db67211a39b30c99eb5d7cfea60a5ae44594ba825244208674ae3142578f6?d=identicon)[jdelacruz2712](/maintainers/jdelacruz2712)

---

Top Contributors

[![hkozacinski-ib](https://avatars.githubusercontent.com/u/21356747?v=4)](https://github.com/hkozacinski-ib "hkozacinski-ib (8 commits)")[![nmenkovic-ib](https://avatars.githubusercontent.com/u/6659468?v=4)](https://github.com/nmenkovic-ib "nmenkovic-ib (5 commits)")[![pducic](https://avatars.githubusercontent.com/u/1651206?v=4)](https://github.com/pducic "pducic (2 commits)")[![dzubchik](https://avatars.githubusercontent.com/u/2685761?v=4)](https://github.com/dzubchik "dzubchik (1 commits)")

---

Tags

apismsInfobiphlrmsisdn

### Embed Badge

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

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

###  Alternatives

[infobip/infobip-api-php-client

PHP library for consuming Infobip's API

921.8M10](/packages/infobip-infobip-api-php-client)[plivo/plivo-php

A PHP SDK to make voice calls &amp; send SMS using Plivo and to generate Plivo XML

1102.8M18](/packages/plivo-plivo-php)[melipayamak/php

A PHP wrapper for melipayamak's web services

3294.4k5](/packages/melipayamak-php)[smsfactor/smsfactor-php-sdk

SMSFactor client library for PHP

15382.5k2](/packages/smsfactor-smsfactor-php-sdk)

PHPackages © 2026

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