承接 offline-agency/laravel-aruba-sms 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

offline-agency/laravel-aruba-sms

Composer 安装命令:

composer require offline-agency/laravel-aruba-sms

包简介

Laravel notification channel and API client for Aruba SMS Panel

README 文档

README

Latest Version on Packagist Tests PHPStan codecov Total Downloads License

Laravel notification channel and API client for the Aruba SMS API Service. See the official API documentation.

Laravel Aruba SMS

Requirements

  • PHP ^8.4
  • Laravel ^12.0 or ^13.0

Installation

From Packagist (when published)

composer require offline-agency/laravel-aruba-sms

Local development (path repository)

Add to your project's composer.json:

{
    "repositories": [
        {
            "type": "path",
            "url": "packages/offline-agency/laravel-aruba-sms",
            "options": {
                "symlink": true
            }
        }
    ]
}

Then:

composer require offline-agency/laravel-aruba-sms

Publish config

php artisan vendor:publish --tag=aruba-sms-config

Configuration

Copy .env.example or add these to your .env:

# Required
ARUBA_SMS_ID=your_username
ARUBA_SMS_PASSWORD=your_password

# Optional
ARUBA_SMS_SENDER=YourBrand              # Default: YourBrand
ARUBA_SMS_SANDBOX=true                  # Default: false (set true for dev/test)
ARUBA_SMS_MINIMUM_SMS=50                # Low credit threshold
ARUBA_SMS_LOW_CREDIT_RECIPIENTS=admin@example.com,dev@example.com
Variable Description Default
ARUBA_SMS_ID Aruba SMS Panel username (required)
ARUBA_SMS_PASSWORD Aruba SMS Panel password (required)
ARUBA_SMS_BASE_URL API base URL https://smspanel.aruba.it/API/v1.0/REST/
ARUBA_SMS_SENDER Sender name on recipient's device YourBrand
ARUBA_SMS_MESSAGE_TYPE SMS type N (Normal)
ARUBA_SMS_SANDBOX Log instead of sending false
ARUBA_SMS_MINIMUM_SMS Low credit alert threshold 50
ARUBA_SMS_LOW_CREDIT_RECIPIENTS Comma-separated admin emails (empty)

Usage

Via Notification Channel

Create a notification that uses the aruba-sms channel:

use Illuminate\Notifications\Notification;
use OfflineAgency\ArubaSms\ArubaSmsMessage;

class OrderShippedNotification extends Notification
{
    public function via($notifiable): array
    {
        return ['aruba-sms'];
    }

    public function toArubaSms($notifiable): ArubaSmsMessage
    {
        return (new ArubaSmsMessage())
            ->content("Your order #{$this->order->id} has been shipped")
            ->to($notifiable->phone_number);
    }
}

Using the Built-in Generic Notification

use OfflineAgency\ArubaSms\Notifications\SendSmsNotification;
use Illuminate\Support\Facades\Notification;

// Send to an on-demand notifiable (no User model needed)
Notification::route('aruba-sms', null)
    ->notify(new SendSmsNotification('Your message', '+393331234567'));

// Or send via a notifiable model
$user->notify(new SendSmsNotification('Your message', '+393331234567'));

Direct Client Usage

use OfflineAgency\ArubaSms\ArubaSmsClient;
use OfflineAgency\ArubaSms\ArubaSmsMessage;

$client = app(ArubaSmsClient::class);
$message = new ArubaSmsMessage('Hello!', '+393331234567');
$response = $client->sendMessage($message);

Via Facade

use OfflineAgency\ArubaSms\Facades\ArubaSms;
use OfflineAgency\ArubaSms\ArubaSmsMessage;

// Send a message
$message = new ArubaSmsMessage('Hello!', '+393331234567');
ArubaSms::sendMessage($message);

// Check remaining credits
$response = ArubaSms::checkSmsStatus();

// Get sending history
$response = ArubaSms::getSmsHistory('20260101000001');

Backward Compatibility (Legacy Pattern)

Notifications with public $message, $recipient, $message_type properties work without implementing toArubaSms():

class LegacyNotification extends Notification
{
    public string $message = 'Hello';
    public string $recipient = '+393331234567';
    public string $message_type = 'N';

    public function via($notifiable): array
    {
        return ['aruba-sms'];
    }
}

Artisan Commands

aruba:sms

Manage the Aruba SMS Panel from the command line:

# Check remaining SMS credits
php artisan aruba:sms status

# View sending history
php artisan aruba:sms history --from=20260101000001 --to=20260201000001

# View history for a specific recipient
php artisan aruba:sms recipient-history --recipient=+393331234567 --from=20260101000001

# Send a test SMS
php artisan aruba:sms notification --phoneNumber=+393331234567

# Get raw remaining credit count (for scripting)
php artisan aruba:sms remaining-credit-raw

aruba:check-remaining-sms

Check remaining credits and send email alerts if below threshold:

php artisan aruba:check-remaining-sms

Configure alert recipients via ARUBA_SMS_LOW_CREDIT_RECIPIENTS env variable.

Phone Number Formatting

The package provides a PhoneNumberFormatter utility for Italian phone numbers:

use OfflineAgency\ArubaSms\Support\PhoneNumberFormatter;

// Add +39 prefix and strip spaces
PhoneNumberFormatter::format('333 123 4567');    // '+393331234567'
PhoneNumberFormatter::format('+393331234567');   // '+393331234567' (unchanged)
PhoneNumberFormatter::format('+447911123456');   // '+447911123456' (non-IT preserved)

// Strip spaces only
PhoneNumberFormatter::stripSpaces('+39 333 123 4567'); // '+393331234567'

Sandbox Mode

When ARUBA_SMS_SANDBOX=true, SMS messages are logged to the Laravel log instead of being sent to the Aruba API. This is useful for development and testing:

[2026-02-19 10:30:00] local.INFO: *** Aruba SMS DEBUG ***
[2026-02-19 10:30:00] local.INFO: Notification sent successfully!
[2026-02-19 10:30:00] local.INFO: Recipient: +393331234567
[2026-02-19 10:30:00] local.INFO: Message: Your code is 123456
[2026-02-19 10:30:00] local.INFO: Message Type: N
[2026-02-19 10:30:00] local.INFO: *** *** ***

Testing

composer test              # Run tests
composer test:coverage     # Run with coverage (100% minimum)
composer analyse           # PHPStan level 6
composer format            # Fix code style (Pint)
composer format:check      # Check code style without fixing

All tests use Pest with Http::fake() and never call the real Aruba API.

License

MIT

offline-agency/laravel-aruba-sms 适用场景与选型建议

offline-agency/laravel-aruba-sms 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 280 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 02 月 20 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「sms」 「laravel」 「italy」 「aruba」 「notification-channel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 offline-agency/laravel-aruba-sms 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 offline-agency/laravel-aruba-sms 我们能提供哪些服务?
定制开发 / 二次开发

基于 offline-agency/laravel-aruba-sms 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 280
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 27
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-02-20