PHPackages                             adelinferaru/laravel-websms - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. adelinferaru/laravel-websms

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

adelinferaru/laravel-websms
===========================

Laravel package for sending SMS through the WebSMS.com.cy gateway.

2.2.1(2w ago)022MITPHPPHP ^8.2CI passing

Since Aug 12Pushed 2w ago1 watchersCompare

[ Source](https://github.com/adelinferaru/laravel-websms)[ Packagist](https://packagist.org/packages/adelinferaru/laravel-websms)[ RSS](/packages/adelinferaru-laravel-websms/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (7)Dependencies (10)Versions (8)Used By (0)

laravel-websms
==============

[](#laravel-websms)

[![CI](https://github.com/adelinferaru/laravel-websms/actions/workflows/ci.yml/badge.svg)](https://github.com/adelinferaru/laravel-websms/actions/workflows/ci.yml)[![Latest Version on Packagist](https://camo.githubusercontent.com/35e1b9e91438d3419c27230f0fb15c988985afb449c5f22e9e7d2f78b46ae1c2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6164656c696e6665726172752f6c61726176656c2d776562736d732e737667)](https://packagist.org/packages/adelinferaru/laravel-websms)[![Total Downloads](https://camo.githubusercontent.com/16d93b961d7793955a266d5090b529134221f95245aea666be91354efa353131/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6164656c696e6665726172752f6c61726176656c2d776562736d732e737667)](https://packagist.org/packages/adelinferaru/laravel-websms)[![PHP Version](https://camo.githubusercontent.com/597ed817a5fadc6a6af85274567f087691185c66b49f7b10cf93f13099b0c8e9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6164656c696e6665726172752f6c61726176656c2d776562736d732e737667)](composer.json)[![License](https://camo.githubusercontent.com/0a079031fec7740428bf8eab31a4aaf4fe728520d6876cd24da82624d54cf5a9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6164656c696e6665726172752f6c61726176656c2d776562736d732e737667)](LICENSE)

Send SMS from Laravel applications through the [WebSMS.com.cy](https://www.websms.com.cy) gateway (Cyprus).

The package wraps the gateway's SOAP web service (full feature set: bulk and scheduled sending, two-way SMS, contact groups) and its REST API (API-key sending), handles authentication transparently, caches the gateway session via Laravel's cache, and ships a native Laravel notification channel.

Requirements
------------

[](#requirements)

- PHP 8.2+ with the `soap` extension
- Laravel 12 or 13

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

[](#installation)

```
composer require adelinferaru/laravel-websms
```

The service provider and the `WebSms` facade are registered via package auto-discovery.

Add your credentials to `.env` (the username is the e-mail address you registered with at WebSMS.com.cy):

```
WEBSMS_USERNAME=your-username
WEBSMS_PASSWORD=your-password
```

Optionally publish the config file to tweak the WSDL endpoint or session caching:

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

Usage
-----

[](#usage)

Via the facade:

```
use Adelinferaru\LaravelWebSms\Facades\WebSms;

// Single recipient
WebSms::sendSms('ACME', '99123456', 'Your order has shipped!');

// Multiple recipients
WebSms::sendSms('ACME', ['99123456', '99654321'], 'Flash sale today only.');

// Remaining account credits (float)
$credits = WebSms::getCredits();

// Delivery status of a sent batch (per-message DELIVERED / EXPIRED / UNDELIVERABLE / UNKNOWN)
$status = WebSms::getBatchStatus($batchId);
```

The gateway accepts at most 100 recipients per `sendSms()` call; the package validates this before calling out. Per the vendor's SOAP guide, recipient numbers use the local Cypriot `9XXXXXXX` format (mobiles starting 99, 96 or 97); the REST API instead takes `357...`/`00357...`-prefixed numbers.

### Scheduled messages

[](#scheduled-messages)

Pass a `DateTimeInterface` to defer delivery, and cancel a scheduled batch before it goes out:

```
$response = WebSms::sendSms('ACME', $phone, 'Sale starts now!', scheduledFor: now()->addDay());

WebSms::cancelScheduledBatch($response->batchId);
```

### Two-way SMS (incoming messages)

[](#two-way-sms-incoming-messages)

The gateway exposes received messages via polling (there are no webhooks). Use the cursors from each response to fetch only newer messages:

```
$inbox = WebSms::getIncomingMessages();                       // first page
$more  = WebSms::getIncomingMessages($since, $lastMessageId); // newer than the cursors

foreach ($inbox->messages ?? [] as $message) {
    // $message->id, ->receivedOn, ->from, ->to, ->message, ->read
}

if ($inbox->hasMore) {
    // keep polling with the returned lastMessageDate / lastMessageId
}
```

### Contacts and groups

[](#contacts-and-groups)

```
WebSms::createContactGroup('Customers');
WebSms::listContactGroups();
WebSms::addContact('John', '99123456', $groupId);
WebSms::checkContactInGroup('99123456', $groupId);
WebSms::removeContactFromGroup('99123456', groupId: $groupId);

// Send (optionally scheduled) to a stored contact
WebSms::pushSms('99123456', 'Hello!', sendAt: now()->addHour());
```

REST client
-----------

[](#rest-client)

The package also ships a client for the gateway's REST API — a lighter transport that authenticates with an API key (generated in your WebSMS account area) instead of a username/password session. The REST API covers sending, credits, and batch status; scheduling, two-way SMS, and contacts are SOAP-only.

```
WEBSMS_API_KEY=XXX-XXX-XXXXX
```

```
use Adelinferaru\LaravelWebSms\Facades\WebSmsRest;

// The REST API takes one recipient per request
WebSmsRest::sendSms('ACME', '35799123456', 'Your order has shipped!');

// Convenience wrapper: one request per recipient
WebSmsRest::sendSmsToMany('ACME', ['35799123456', '35799654321'], 'Hello');

WebSmsRest::checkKey();              // bool
WebSmsRest::getCredits();            // float
WebSmsRest::getBatchStatus($batchId);
```

Recipient numbers use the `357...` or `00357...` prefix format; a leading `+` is stripped automatically since the gateway rejects it. Sender IDs must be 3–11 characters. Message length per encoding: GSM 160/306/459 characters for 1/2/3 segments, UCS2 70/134/201.

`Adelinferaru\LaravelWebSms\WebSmsRestClient` is also container-resolvable for constructor injection, like the SOAP client.

Notification channel
--------------------

[](#notification-channel)

The package registers a `websms` notification channel, so you can deliver Laravel notifications as SMS. Set a default sender in `.env`:

```
WEBSMS_FROM=ACME
```

Return the channel from your notification and implement `toWebsms()`:

```
use Adelinferaru\LaravelWebSms\Notifications\WebSmsMessage;
use Illuminate\Notifications\Notification;

class OrderShipped extends Notification
{
    public function via(object $notifiable): array
    {
        return ['websms'];
    }

    public function toWebsms(object $notifiable): WebSmsMessage
    {
        return WebSmsMessage::create('Your order has shipped!')
            ->from('ACME')                       // optional, defaults to WEBSMS_FROM
            ->unicode()                          // optional, UCS2 for non-GSM text
            ->scheduledFor(now()->addMinutes(5)); // optional
    }
}
```

`toWebsms()` may also return a plain string. Tell the channel where to send by adding a route to your notifiable:

```
class User extends Authenticatable
{
    use Notifiable;

    public function routeNotificationForWebsms(): string
    {
        return $this->phone_number;
    }
}
```

Or inject the client where you prefer constructor injection:

```
use Adelinferaru\LaravelWebSms\WebSmsClient;

class OrderShippedNotifier
{
    public function __construct(private WebSmsClient $webSms) {}

    public function notify(string $phone): void
    {
        $this->webSms->sendSms('ACME', $phone, 'Your order has shipped!');
    }
}
```

### Error handling

[](#error-handling)

All gateway failures throw `Adelinferaru\LaravelWebSms\Exceptions\WebSmsException`. Invalid credentials throw the more specific `Adelinferaru\LaravelWebSms\Exceptions\AuthenticationException` (a subclass), so you can catch either level:

```
use Adelinferaru\LaravelWebSms\Exceptions\WebSmsException;

try {
    WebSms::sendSms('ACME', $phone, $message);
} catch (WebSmsException $e) {
    report($e);
}
```

### Message encoding

[](#message-encoding)

`sendSms()` defaults to the `GSM` data coding — the only encodings the gateway accepts are `GSM` and `UCS2` (Unicode). Pass the `DataCoding` enum (or its string value) when sending non-GSM content:

```
use Adelinferaru\LaravelWebSms\DataCoding;

WebSms::sendSms('ACME', $phone, 'Γειά σου', DataCoding::Ucs2);
```

Upgrading from 1.x
------------------

[](#upgrading-from-1x)

Version 2 is a rewrite targeting Laravel 12+. The notable breaking changes:

1.x2.x`LaravelWebSms` class`WebSmsClient``sendSMS()``sendSms()``getCreditsLeft()``getCredits()``getBatch()``getBatchStatus()`Session stored in a temp fileSession stored in the Laravel cache`die()` / echoed SOAP dumps on failure`WebSmsException` / `AuthenticationException`nusoap clientNative PHP `soap` extensionConfig changes: the file is still published as `config/websms.php`, but `wsdl_file` is now `wsdl`, and `session_path`/`session_ttl` were replaced by the `session` array (`store`, `key`, `ttl`).

Testing
-------

[](#testing)

```
composer test      # PHPUnit
composer analyse   # PHPStan (level max)
composer lint      # Pint
```

License
-------

[](#license)

The MIT License. Copyright (c) 2017-2026 Feraru Ioan Adelin. See [LICENSE](LICENSE).

###  Health Score

51

—

FairBetter than 95% of packages

Maintenance96

Actively maintained with recent releases

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity80

Battle-tested with a long release history

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

Recently: every ~0 days

Total

7

Last Release

20d ago

Major Versions

1.0.1 → 2.0.02026-06-10

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/4851269?v=4)[Feraru Ioan Adelin](/maintainers/adelinferaru)[@adelinferaru](https://github.com/adelinferaru)

---

Top Contributors

[![adelinferaru](https://avatars.githubusercontent.com/u/4851269?v=4)](https://github.com/adelinferaru "adelinferaru (22 commits)")

---

Tags

cypruslaravellaravel-packagenotification-channelphpsmssms-gatewaywebsmslaravelsmswebsmscyprus

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/adelinferaru-laravel-websms/health.svg)

```
[![Health](https://phpackages.com/badges/adelinferaru-laravel-websms/health.svg)](https://phpackages.com/packages/adelinferaru-laravel-websms)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M337](/packages/psalm-plugin-laravel)[laravel/socialite

Laravel wrapper around OAuth 1 &amp; OAuth 2 libraries.

5.7k108.5M846](/packages/laravel-socialite)[spatie/laravel-health

Monitor the health of a Laravel application

87511.3M155](/packages/spatie-laravel-health)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9762.4M123](/packages/roots-acorn)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

77022.3M131](/packages/laravel-mcp)[spatie/laravel-export

Create a static site bundle from a Laravel app

673139.5k6](/packages/spatie-laravel-export)

PHPackages © 2026

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