PHPackages                             infobip/oneapi - 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. infobip/oneapi

Abandoned → infobip-api-php-clientLibrary[API Development](/categories/api)

infobip/oneapi
==============

Infobip OneAPI library for PHP

1.1.3(11y ago)1248.1k↓25%11[2 issues](https://github.com/infobip/oneapi-php/issues)4Apache-2.0PHP

Since Dec 30Pushed 12mo ago12 watchersCompare

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

READMEChangelogDependenciesVersions (4)Used By (4)

⚠️ Deprecated
-------------

[](#️-deprecated)

**This repository is deprecated and no longer actively maintained, it will be archived in the near future.**

If you're looking for an active alternative, we recommend using [infobip-api-php-client](https://github.com/infobip/infobip-api-php-client) instead.

You’re still welcome to browse or fork the code, but issues and pull requests will not be monitored.

\#OneApi PHP client

*Note: For non composer version switch to this [repository](https://github.com/infobip/oneapi-php-non-composer)*

\##Installation

Add this to your `composer.json` file.

```
{
    "require": {
            "infobip/oneapi": "dev-master"
    }
}

```

\##Basic messaging example

First include `autoload.php` and initialize the messaging client using your username and password:

```
require_once '\autoload.php';

$smsClient = new \infobip\SmsClient(USERNAME, PASSWORD);

```

An exception will be thrown if your *username* and/or `password` are incorrect.

Prepare the message:

```
$smsMessage = new \infobip\models\SMSRequest();
$smsMessage->senderAddress = SENDER_ADDRESS;
$smsMessage->address = DESTINATION_ADDRESS;
$smsMessage->message = 'Hello world';

```

Send the message:

```
$smsMessageSendResult = $smsClient->sendSMS($smsMessage);

```

Later you can query for the delivery status of the message:

```
// You can use $clientCorrelator or $smsMessageSendResult as an method call argument here:
$smsMessageStatus = $smsClient->queryDeliveryStatus($smsMessageSendResult);
$deliveryStatus = $smsMessageStatus->deliveryInfo[0]->deliveryStatus;

echo 'Success:', $smsMessageStatus->isSuccess(), "\n";
echo 'Status:', $deliveryStatus, "\n";
if( ! $smsMessageStatus->isSuccess()) {
    echo 'Message id:', $smsMessageStatus->exception->messageId, "\n";
    echo 'Text:', $smsMessageStatus->exception->text, "\n";
    echo 'Variables:', $smsMessageStatus->exception->variables, "\n";
}

```

Possible statuses are: **DeliveredToTerminal**, **DeliveryUncertain**, **DeliveryImpossible**, **MessageWaiting** and **DeliveredToNetwork**.

\##Messaging with notification push example

Same as with the standard messaging example, but when preparing your message:

```
$smsMessage = new \infobip\models\SMSRequest();
$smsMessage->senderAddress = SENDER_ADDRESS;
$smsMessage->address = DESTINATION_ADDRESS;
$smsMessage->message = 'Hello world';
$smsMessage->notifyURL = NOTIFY_URL;

```

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

```
$result = \infobip\SmsClient::unserializeDeliveryStatus();

// Process $result here, e.g. just save it to a file:
$f = fopen(FILE_NAME, 'w');
fwrite($f, "\n-------------------------------------\n");
fwrite($f, 'status: ' . $result->deliveryInfo->deliveryStatus . "\n") ;
fwrite($f, 'address: ' . $result->deliveryInfo->address . "\n");
fwrite($f, 'messageId: ' . $result->deliveryInfo->messageId . "\n");
fwrite($f, 'clientCorrelator: '. $result->deliveryInfo->clientCorrelator . "\n");
fwrite($f, 'callback data: ' . $result->callbackData . "\n");
fwrite($f, "\n-------------------------------------\n");
fclose($f);

```

\##Sending message with special characters example

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

```
$smsMessage = new \infobip\models\SMSRequest();
$smsMessage->senderAddress = SENDER_ADDRESS;
$smsMessage->address = DESTINATION_ADDRESS;
$smsMessage->message = MESSAGE_TEXT;

$language = new \infobip\models\Language();

//specific language code
$language->languageCode = LANGUAGE_CODE;

//use locking shift table for specific language ('false' or 'true')
$language->useLockingShift = USE_LOCKING_SHIFT;

//use single shift table for specific language ('false' or 'true')
$language->useSingleShift = USE_SINGLE_SHIFT;

$smsMessage->language = $language;

```

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

\##Number Context example

Initialize and login the data connection client:

```
$client = new \infobip\DataConnectionProfileClient(USERNAME, PASSWORD);

```

Retrieve the roaming status (Number Context):

```
$response = $client->retrieveRoamingStatus(DESTINATION_ADDRESS);
echo 'Number context result: \n';
echo 'servingMccMnc: ', $response->servingMccMnc,'\n';
echo 'address: ', $response->address,'\n';
echo 'currentRoaming: ', $response->currentRoaming,'\n';
echo 'resourceURL: ', $response->resourceURL,'\n';
echo 'retrievalStatus: ', $response->retrievalStatus,'\n';
echo 'callbackData: ', $response->callbackData,'\n';
echo 'extendedData: ', $response->extendedData,'\n';
echo 'IMSI: ', $response->extendedData->imsi,'\n';
echo 'destinationAddres: ', $response->extendedData->destinationAddress,'\n';
echo 'originalNetworkPrefix: ', $response->extendedData->originalNetworkPrefix,'\n';
echo 'portedNetworkPrefix: ', $response->extendedData->portedNetworkPrefix,'\n';

```

\##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:

```
$response = $client->retrieveRoamingStatus(DESTINATION_ADDRESS, NOTIFY_URL);
// if there is no error the query has been succesfully executed
if(!$response->isSuccess()) {
    echo 'Error:', $response->exception, "\n";
    infobip\utils\Logs::printLogs();
}

```

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

```
$result = DataConnectionProfileClient::unserializeRoamingStatus();

// Process $result here, e.g. just save it to a file:
$f = fopen(FILE_NAME, 'w');
fwrite($f, "\n-------------------------------------\n");
fwrite($f, 'callbackData: ' . $result->callbackData . "\n") ;
fwrite($f, 'servingMccMnc: '. $result->terminalRoamingStatus->servingMccMnc . "\n") ;
fwrite($f, 'address: '. $result->terminalRoamingStatus->address . "\n") ;
fwrite($f, 'currentRoaming: ' . $result->terminalRoamingStatus->currentRoaming . "\n") ;
fwrite($f, 'resourceURL: ' . $result->terminalRoamingStatus->resourceURL . "\n") ;
fwrite($f, 'retrievalStatus: ' . $result->terminalRoamingStatus->retrievalStatus . "\n") ;
fwrite($f, 'terminalRoamingStatus callbackData: ' . $result->terminalRoamingStatus->callbackData . "\n") ;
fwrite($f, 'extendedData: ' . $result->terminalRoamingStatus->extendedData . "\n") ;
fwrite($f, 'IMSI: ', $response->extendedData->imsi,'\n');
fwrite($f, 'destinationAddress: ', $response->extendedData->destinationAddress,'\n');
fwrite($f, 'originalNetworkPrefix: ', $response->extendedData->originalNetworkPrefix,'\n');
fwrite($f, 'portedNetworkPrefix: ', $response->extendedData->portedNetworkPrefix,'\n');
fwrite($f, "\n-------------------------------------\n");
fclose($f);

```

\##Retrieve inbound messages example

With the existing sms client (see the basic messaging example to see how to start it):

```
$inboundMessages = $smsClient->retrieveInboundMessages();

foreach($inboundMessages->inboundSMSMessage as $message) {
    echo $message->dateTime;
    echo $message->destinationAddress;
    echo $message->messageId;
    echo $message->message;
    echo $message->resourceURL;
    echo $message->senderAddress;
}

```

\##Inbound message push example

The subscription to receive inbound messages can be set up on our site. When the inbound message notification is pushed to your server as a HTTP POST request, you must process the body of the message with the following code:

```
// returns a single message not array of messages
$inboundMessages = \infobip\SmsClient::unserializeInboundMessages();

// Process $inboundMessages here, e.g. just save it to a file:
$f = fopen(FILE_NAME, 'w');
fwrite($f, "\n-------------------------------------\n");
fwrite($f, 'dateTime: ' . $inboundMessages->dateTime . "\n");
fwrite($f, 'destinationAddress: '  . $inboundMessages->destinationAddress . "\n");
fwrite($f, 'messageId: '  . $inboundMessages->messageId . "\n");
fwrite($f, 'message: '  . $inboundMessages->message . "\n");
fwrite($f, 'resourceURL: '  . $inboundMessages->resourceURL . "\n");
fwrite($f, 'senderAddress: '  . $inboundMessages->senderAddress . "\n");

```

\##Social invites sms example

If you have Social Invites application registered and configured ([tutorial](http://developer.infobip.com/getting-started/tutorials/social-invite)), you can send invitations.

First initialize the social invites client using your username and password:

```
$socinv = new \infobip\SocialInviteClient(USERNAME, PASSWORD);

```

Prepare the social invitation:

```
$siReq = new \infobip\models\SocialInviteRequest();
$siReq->senderAddress = SENDER_ADDRESS;
$siReq->recipients = DESTINATION_ADDRESS;
$siReq->messageKey = SOCIAL_INVITES_MESSAGE_KEY;

```

Send the message:

```
$siResult = $socinv->sendInvite($siReq, SOCIAL_INVITES_APP_SECRET);

```

Later you can query for the delivery status of the social invite message:

```
// You can use $siResult->sendSmsResponse->bulkId as an argument here:
$smsMessageStatus = $smsClient->queryDeliveryStatus($siResult->sendSmsResponse->bulkId);
$deliveryStatus = $smsMessageStatus->deliveryInfo[0]->deliveryStatus;

echo 'Success:', $smsMessageStatus->isSuccess(), "\n";
echo 'Status:', $deliveryStatus, "\n";
if( ! $smsMessageStatus->isSuccess()) {
    echo 'Message id:', $smsMessageStatus->exception->messageId, "\n";
    echo 'Text:', $smsMessageStatus->exception->text, "\n";
    echo 'Variables:', $smsMessageStatus->exception->variables, "\n";
}

```

\##License

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

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance33

Infrequent updates — may be unmaintained

Popularity36

Limited adoption so far

Community31

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 68.1% 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

Unknown

Total

1

Last Release

4157d ago

### Community

Maintainers

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

![](https://avatars.githubusercontent.com/u/2333491?v=4)[Miroslav Milivojevic](/maintainers/mmiroslav)[@mmiroslav](https://github.com/mmiroslav)

---

Top Contributors

[![tkrajina](https://avatars.githubusercontent.com/u/379243?v=4)](https://github.com/tkrajina "tkrajina (92 commits)")[![mmiroslav](https://avatars.githubusercontent.com/u/2333491?v=4)](https://github.com/mmiroslav "mmiroslav (13 commits)")[![anamarjanovic](https://avatars.githubusercontent.com/u/10340920?v=4)](https://github.com/anamarjanovic "anamarjanovic (8 commits)")[![Brakus](https://avatars.githubusercontent.com/u/1122328?v=4)](https://github.com/Brakus "Brakus (6 commits)")[![nmenkovic-ib](https://avatars.githubusercontent.com/u/6659468?v=4)](https://github.com/nmenkovic-ib "nmenkovic-ib (3 commits)")[![lvukadinovic-ib](https://avatars.githubusercontent.com/u/138505157?v=4)](https://github.com/lvukadinovic-ib "lvukadinovic-ib (2 commits)")[![pducic](https://avatars.githubusercontent.com/u/1651206?v=4)](https://github.com/pducic "pducic (2 commits)")[![rbelusic](https://avatars.githubusercontent.com/u/1949629?v=4)](https://github.com/rbelusic "rbelusic (2 commits)")[![maricn](https://avatars.githubusercontent.com/u/3995223?v=4)](https://github.com/maricn "maricn (2 commits)")[![tara-oroz](https://avatars.githubusercontent.com/u/5088161?v=4)](https://github.com/tara-oroz "tara-oroz (1 commits)")[![r3dh4nd5](https://avatars.githubusercontent.com/u/1433639?v=4)](https://github.com/r3dh4nd5 "r3dh4nd5 (1 commits)")[![DjurdjicaP](https://avatars.githubusercontent.com/u/20597464?v=4)](https://github.com/DjurdjicaP "DjurdjicaP (1 commits)")[![nmenkovic](https://avatars.githubusercontent.com/u/8648126?v=4)](https://github.com/nmenkovic "nmenkovic (1 commits)")[![jvalecillos](https://avatars.githubusercontent.com/u/89293?v=4)](https://github.com/jvalecillos "jvalecillos (1 commits)")

### Embed Badge

![Health badge](/badges/infobip-oneapi/health.svg)

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

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[facebook/php-business-sdk

PHP SDK for Facebook Business

90821.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

74513.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

265103.1M454](/packages/google-gax)[google/common-protos

Google API Common Protos for PHP

173103.7M50](/packages/google-common-protos)

PHPackages © 2026

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