PHPackages                             messageowl/msgowl-php - 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. messageowl/msgowl-php

ActiveLibrary[API Development](/categories/api)

messageowl/msgowl-php
=====================

PHP SDK for the MessageOwl SMS API

v1.0.0(3mo ago)08↓90.9%MITPHPPHP ^8.2CI passing

Since Mar 31Pushed 3mo agoCompare

[ Source](https://github.com/messageowl/msgowl-php)[ Packagist](https://packagist.org/packages/messageowl/msgowl-php)[ RSS](/packages/messageowl-msgowl-php/feed)WikiDiscussions main Synced 4w ago

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

MessageOwl PHP SDK
==================

[](#messageowl-php-sdk)

PHP SDK for the [MessageOwl](https://msgowl.com) SMS API.

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

[](#installation)

```
composer require messageowl/msgowl-php
```

Laravel Setup
-------------

[](#laravel-setup)

Add your API key to `.env`:

```
MESSAGEOWL_API_KEY=your-api-key
```

The service provider is auto-discovered. Optionally publish the config:

```
php artisan vendor:publish --tag=messageowl-config
```

Plain PHP Setup
---------------

[](#plain-php-setup)

```
use MessageOwl\MessageOwl;

$client = new MessageOwl('your-api-key');
```

Authentication
--------------

[](#authentication)

By default the SDK uses the `Authorization: AccessKey {key}` header. If headers are unavailable, switch to query param auth:

```
$client = new MessageOwl('your-api-key', useQueryAuth: true);
```

---

Usage
-----

[](#usage)

### Send a Message

[](#send-a-message)

```
// Single recipient
$response = $client->message()
    ->to('9609848571')
    ->from('MyApp')
    ->body('Hello from MessageOwl!')
    ->send();

echo $response->id;      // int
echo $response->message; // "Message has been sent successfully."

// Multiple recipients
$client->message()
    ->to(['9609848571', '9609876543'])
    ->from('MyApp')
    ->body('Hello!')
    ->send();
```

### List Messages

[](#list-messages)

```
// Latest 100 messages
$messages = $client->messages()->all();

foreach ($messages as $message) {
    echo $message->id;
    echo $message->smsHeader;
    echo $message->status;
    echo $message->createdAt;
    echo $message->body; // null if message.body.read scope is absent
}
```

### Fetch a Message

[](#fetch-a-message)

```
$message = $client->messages()->find(8848);

echo $message->accountId;

foreach ($message->recipients as $recipient) {
    echo $recipient->phoneNumber;
    echo $recipient->deliveryStatus->name; // DeliveryStatus enum
    echo $recipient->smsStatus->name;      // SmsStatus enum
    echo $recipient->deliveredOn;
}
```

### OTP

[](#otp)

```
// Send OTP (code auto-generated if omitted)
$otp = $client->otp()->send('9609999999');
$otp = $client->otp()->send('9609999999', codeLength: 8);
$otp = $client->otp()->send('9609999999', code: '235311');

echo $otp->id;
echo $otp->phoneNumber;
echo $otp->timestamp;
echo $otp->messageId;

// Resend OTP
$otp = $client->otp()->resend('9609999999', id: $otp->id);

// Verify OTP
$result = $client->otp()->verify('9609999999', '235311');

echo $result->status ? 'Verified' : 'Invalid';
```

### Groups

[](#groups)

```
// List
$groups = $client->groups()->all();

// Fetch (includes contacts)
$group = $client->groups()->find(22);
foreach ($group->contacts as $contact) {
    echo $contact->name;
    echo $contact->number;
}

// Create
$group = $client->groups()->create('My Group');

// Update
$group = $client->groups()->update(22, 'New Name');

// Delete
$client->groups()->delete(22); // returns true
```

### Contacts

[](#contacts)

```
// List (paginated, 100 per page)
$list = $client->contacts()->all(page: 1);

echo $list->currentPage;
echo $list->nextPage;
echo $list->previousPage;

foreach ($list->contacts as $contact) {
    echo $contact->name;
    echo $contact->number;
}

// Create (optionally assign to groups by name)
$contact = $client->contacts()->create('John', '9609999999', ['My Group']);

foreach ($contact->groups as $group) {
    echo $group->id;
    echo $group->name;
}

// Update
$contact = $client->contacts()->update(1232, 'John Updated', '9609999999', ['My Group']);

// Delete
$client->contacts()->delete(1232); // returns true
```

### Balance

[](#balance)

```
$balance = $client->balance();

echo $balance->balance; // "130.6347" (string)
```

### Sender IDs

[](#sender-ids)

```
$senderIds = $client->senderIds();

foreach ($senderIds as $sender) {
    echo $sender->name;
    echo $sender->status;    // "approved" | "pending verification"
    echo $sender->purpose;   // nullable
    echo $sender->remarks;   // nullable
    echo $sender->handledAt; // nullable
}
```

---

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

[](#exception-handling)

```
use MessageOwl\Exceptions\AuthenticationException;
use MessageOwl\Exceptions\MethodNotAllowedException;
use MessageOwl\Exceptions\MessageOwlException;
use MessageOwl\Exceptions\NotFoundException;
use MessageOwl\Exceptions\RateLimitException;
use MessageOwl\Exceptions\RequestTimeoutException;
use MessageOwl\Exceptions\ServerException;
use MessageOwl\Exceptions\ValidationException;

try {
    $client->message()->to('9609848571')->from('App')->body('Hi')->send();
} catch (AuthenticationException $e) {
    // 401 — invalid API key
} catch (NotFoundException $e) {
    // 404 — resource not found
} catch (MethodNotAllowedException $e) {
    // 405
} catch (RequestTimeoutException $e) {
    // 408 or connection timeout
} catch (ValidationException $e) {
    // 422 — check $e->bulkLimit for bulk limit violations
    if ($e->bulkLimit !== null) {
        echo "Bulk limit: {$e->bulkLimit}";
    }
} catch (RateLimitException $e) {
    // 429 — retry after $e->retryAfter seconds
    echo "Retry after: {$e->retryAfter}s";
    echo "Limit: {$e->rateLimitLimit}";
    echo "Remaining: {$e->rateLimitRemaining}";
    echo "Reset at: {$e->rateLimitReset}";
} catch (ServerException $e) {
    // 5xx
} catch (MessageOwlException $e) {
    // catch-all for any other SDK error
}
```

---

Rate Limiting
-------------

[](#rate-limiting)

The API allows **50 POST requests per 60 seconds** per account. When exceeded, a `RateLimitException` is thrown with the `retryAfter` property set to the number of seconds to wait.

---

Laravel Facade
--------------

[](#laravel-facade)

```
use MessageOwl\Laravel\Facades\MessageOwl;

MessageOwl::message()->to('9609848571')->from('MyApp')->body('Hello!')->send();
MessageOwl::balance();
MessageOwl::senderIds();
```

---

Contributing
------------

[](#contributing)

See [CONTRIBUTING.md](CONTRIBUTING.md).

License
-------

[](#license)

MIT — see [LICENSE](LICENSE).

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance82

Actively maintained with recent releases

Popularity6

Limited adoption so far

Community6

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

91d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4328bca4950f395c255df9ae6d5636863d86dd75e228c9b7491cdb7df7b88a30?d=identicon)[chumputy](/maintainers/chumputy)

---

Top Contributors

[![chumputys](https://avatars.githubusercontent.com/u/73405613?v=4)](https://github.com/chumputys "chumputys (6 commits)")

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/messageowl-msgowl-php/health.svg)

```
[![Health](https://phpackages.com/badges/messageowl-msgowl-php/health.svg)](https://phpackages.com/packages/messageowl-msgowl-php)
```

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3661.2M46](/packages/tencentcloud-tencentcloud-sdk-php)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k496.1k34](/packages/neuron-core-neuron-ai)[avalara/avataxclient

Client library for Avalara's AvaTax suite of business tax calculation and processing services. Uses the REST v2 API.

528.3M7](/packages/avalara-avataxclient)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

252.5k](/packages/eslazarev-wildberries-sdk)[files.com/files-php-sdk

Files.com PHP SDK

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

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

1942.4k4](/packages/aimeos-prisma)

PHPackages © 2026

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