PHPackages                             opilo/webservice - 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. opilo/webservice

ActiveLibrary[API Development](/categories/api)

opilo/webservice
================

This is a client of Opilo (www.opilo.com) Web Service

1.0.1(9y ago)34156PHPPHP &gt;=5.5.0

Since Sep 8Pushed 9y ago3 watchersCompare

[ Source](https://github.com/opilo/webservice)[ Packagist](https://packagist.org/packages/opilo/webservice)[ RSS](/packages/opilo-webservice/feed)WikiDiscussions master Synced yesterday

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

Webservice Client for opilo.com panel
=====================================

[](#webservice-client-for-opilocom-panel)

Usage
-----

[](#usage)

First, install the `opilo/webservice` package through [Composer PHP dependency manager](https://getcomposer.org/):

```
composer require opilo/webservice

```

**Note**: if you like to know more about composer, please visit .

After installing the composer package, in order to send and receive SMS via opilo.com panel, you should create an instance object of class OpiloClient\\V2\\HttpClient. For that, first you need to configure your webservice in [the configuration page](http://bpanel.opilo.com/api).

Create a Client Object
----------------------

[](#create-a-client-object)

```
use OpiloClient\V2\HttpClient;
...
$client = new HttpClient('YOUR_WEBSERVICE_USERNAME', 'YOUR_WEBSERVICE_PASSWORD');
```

Sending SMS
-----------

[](#sending-sms)

### Sending a Single SMS

[](#sending-a-single-sms)

```
use OpiloClient\Request\OutgoingSMS;
...
$message = new OutgoingSMS('3000****', '0912*******', 'Hello World!');
$responses = $client->sendSMS($message);
```

### Sending a Batch of SMS at Once

[](#sending-a-batch-of-sms-at-once)

```
$messages = [
    new OutgoingSMS('3000****', '0912*******', 'Hello World!'),
    new OutgoingSMS('3000****', '0912*******', 'Hello World!'),
];
$response = $client->sendSMS($messages);
```

### User defined ids

[](#user-defined-ids)

In case of network errors, you may resend your SMS to be sure it is delivered to the Opilo server, but you don't want it to be sent to the target more than once. To prevent duplicate SMSes you can set unique strings as uid fields of the `OutgoingSMS` objects. In case of receiving a SMS with a duplicate uid, the Opilo server drops that SMS and return an SMSId object with a boolean `duplicate` flag. The duplication of a `uid` is checked only against the messages sent during the last 24 hours.

```
$messages = [
    new OutgoingSMS('3000****', '0912*******', 'Dont send this twice!', $some_unique_identifier_for_this_sms),
];
```

### Parsing The Return Value of sendSMS()

[](#parsing-the-return-value-of-sendsms)

```
use OpiloClient\Response\SMSId;
use OpiloClient\Response\SendError;
...
for ($i = 0; $i < count($response); $i++) {
    if ($response[$i] instanceof SMSId) {
        //store $response[$i]->id as the id of $messages[$i] in your database and schedule for checking status if needed
    } elseif ($response[$i] instanceof SendError) {
        //It could be that you run out of credit, the line number is invalid, or the receiver number is invalid.
        //To find out more examine $response[$i]->error and compare it against constants in SendError class
    }
}
```

Check the Inbox by Pagination
-----------------------------

[](#check-the-inbox-by-pagination)

```
$minId = 0;
while (true) {
    $inbox = $client->checkInbox($minId);
    $messages = $inbox->getMessages();
    if (count($messages)) {
        foreach ($messages as $message) {
            //Process $message->opiloId(), $message->getFrom(), $message->getTo(), $message->getText(), and $message->getReceivedAt() and store them in your database
            $minId = max($minId, $message->getOpiloId() + 1);
        }
    } else {
        //no new SMS
        //Store $minId in your database for later use of this while loop! You don't need to start from 0 tomorrow!
        break;
    }
}
```

Checking the Delivery Status of Sent Messages
---------------------------------------------

[](#checking-the-delivery-status-of-sent-messages)

```
$opiloIds = $yourDatabaseRepository->getArrayOfOpiloIdsOfMessagesSentViaSendSMSFunction();
$response = $client->checkStatus($opiloIds);
foreach ($response->getStatusArray() as $opiloId => $status) {
    //process and store the status code $status->getCode() for the SMS with Id $opiloId
    //Take a look at constants in OpiloClient\Response\Status class and their meanings
}
```

Getting Your SMS Credit
-----------------------

[](#getting-your-sms-credit)

```
$numberOfSMSYouCanSendBeforeNeedToCharge = $client->getCredit()->getSmsPageCount();
```

Exception Handling
------------------

[](#exception-handling)

All the functions in HttpClient may throw CommunicationException if the credentials or configurations are invalid, or if there is a network or server error. Prepare to catch the exceptions appropriately.

```
use OpiloClient\Response\CommunicationException;
...
try {
    ...
    $client->sendSMS(...);
    ...
} catch (CommunicationException $e) {
    //process the exception by comparing $e->getCode() against constants defined in CommunicationException class.
}
```

Laravel support
---------------

[](#laravel-support)

To use web service in Laravel, register `OpiloClient\Laravel\OpiloServiceProvider` in your `config/app.php`.

```
    'providers' => [
        // Add this to end of 'providers' array
        OpiloClient\Laravel\OpiloServiceProvider::class,
    ]
```

You can also add the facade to use web service more conveniently.

```
    'aliases' => [
        // Add this to end of 'aliases' array
        'Opilo' => OpiloClient\Laravel\HttpClient::class,
    ]
```

To publish opilo config file, run `php artisan vendor:publish --provider="OpiloClient\Laravel\OpiloServiceProvider"`. Put variables `OPILO_WS_USERNAME` and `OPILO_WS_PASSWORD` into your `.env` file.

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity63

Established project with proven stability

 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

Every ~71 days

Recently: every ~96 days

Total

7

Last Release

3523d ago

Major Versions

0.1.0 → 1.0.02016-04-27

### Community

Maintainers

![](https://www.gravatar.com/avatar/99120607c0e363e8400dc96ba32624b746a82a2b2799e3fdcb506e3d6061981d?d=identicon)[opilo](/maintainers/opilo)

---

Top Contributors

[![halaei](https://avatars.githubusercontent.com/u/7089140?v=4)](https://github.com/halaei "halaei (53 commits)")

---

Tags

web servicesmsmessagingLaravel SMS DriverOpilo

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/opilo-webservice/health.svg)

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

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3741.3M46](/packages/tencentcloud-tencentcloud-sdk-php)[plivo/plivo-php

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

1143.1M19](/packages/plivo-plivo-php)[plivo/php-sdk

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

1112.0M6](/packages/plivo-php-sdk)[files.com/files-php-sdk

Files.com PHP SDK

2481.1k](/packages/filescom-files-php-sdk)[aimeos/prisma

A powerful PHP package for integrating media related Large Language Models (LLMs) into your applications

1943.1k5](/packages/aimeos-prisma)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

252.5k](/packages/eslazarev-wildberries-sdk)

PHPackages © 2026

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