PHPackages                             oxik/one-api-bundle - 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. oxik/one-api-bundle

AbandonedSymfony-bundle[API Development](/categories/api)

oxik/one-api-bundle
===================

One-Api Infobip to use in Symfony 2.3+

0.0.1(11y ago)21991Apache License 2.0PHPPHP &gt;=5.3.2

Since May 8Pushed 11y ago2 watchersCompare

[ Source](https://github.com/OXIK/oneapi-bundle)[ Packagist](https://packagist.org/packages/oxik/one-api-bundle)[ RSS](/packages/oxik-one-api-bundle/feed)WikiDiscussions master Synced 1mo ago

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

OneApiBundle for Symfony2 0.0.1
===============================

[](#oneapibundle-for-symfony2-001)

What is OneApiBundle?
---------------------

[](#what-is-oneapibundle)

It's a small symfony bundle that acts like a bridge between [infobip OneApi](https://github.com/infobip/oneapi-php) and your symfony project.

Simple wrap the OneApi objects into your services or controllers.

The next documentation is ported from OneApi and adapted to the use in your symfony 2 project.

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

[](#installation)

Add this to your `composer.json` file.

```
    {
        "require": {
            ...
            "infobip/oneapi": "dev-master",
            "oxik/one-api-bundle": "^0.0.1"
        }
    }
```

And to `AppKernel.php`

```
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            ...
            new Oxik\OneApiBundle\OxikOneApiBundle(),
        );
    }
}
```

Add your username and password to `config.yml' file.

```
# OneApiBundle Configuration
oxik_one_api:
    username: USERNAME
    password: PASSWORD
    baseUrl: ~
```

Use of static::functions
------------------------

[](#use-of-staticfunctions)

You still can use the static functions of OneApi, load `infobin/class` namespace manually.

Basic messaging example
-----------------------

[](#basic-messaging-example)

First include the OneApiBundle `Wrapper` service into your code and retrieve a new instance of `SmsClient`.

```
$serviceWrapper = $this->get('oxik_one_api.wrapper');
$smsClient = $serviceWrapper->getService('SmsClient', true);
```

The first argument is the class to initialize from OneApi, the second one are the arguments of the class (if true then username and password will be passed to the function, insert an array instead to set your own custom arguments).

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

Prepare the message:

```
$smsMessage = $serviceWrapper->getModel('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 = $serviceWrapper->getModel('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 = $smsClient->queryDeliveryStatus($send);
// 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 = $serviceWrapper->getModel('SMSRequest');
$smsMessage->senderAddress = SENDER_ADDRESS;
$smsMessage->address = DESTINATION_ADDRESS;
$smsMessage->message = MESSAGE_TEXT;

$language = $serviceWrapper->getModel('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 = $serviceWrapper->getService('DataConnectionProfileClient', true);
```

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';
```

\##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;
}
```

\##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 = $serviceWrapper->getService('SocialInviteClient', true);
```

Prepare the social invitation:

```
$siReq = $serviceWrapper->getModel('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 (and OneApi PHP) is licensed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0)

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

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

4028d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/592e627cd145667eda3053f08eb8e9d26e84cc8e99753e060ec35b4c34508513?d=identicon)[Arrogance](/maintainers/Arrogance)

---

Top Contributors

[![Arrogance](https://avatars.githubusercontent.com/u/284882?v=4)](https://github.com/Arrogance "Arrogance (12 commits)")

---

Tags

Infobip

### Embed Badge

![Health badge](/badges/oxik-one-api-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/oxik-one-api-bundle/health.svg)](https://phpackages.com/packages/oxik-one-api-bundle)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[cravler/maxmind-geoip-bundle

Bundle integrating MaxMind GeoIP2 database into symfony application

27615.8k2](/packages/cravler-maxmind-geoip-bundle)[sulu/headless-bundle

Bundle that provides controllers and services for using Sulu as headless content management system

55133.7k2](/packages/sulu-headless-bundle)

PHPackages © 2026

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