magic-systems-io/laravel-notifyre-sms

A Notifyre wrapper for laravel

0.2.5 2025-09-04 09:21 UTC

This package is auto-updated.

Last update: 2025-09-04 09:24:02 UTC


README

A comprehensive Laravel-native SMS package that integrates with Notifyre's SMS service. Send SMS directly, through Laravel notifications, or via REST API with database persistence and advanced features.

Tests Code Coverage

✨ Features

  • πŸš€ Direct SMS Sending - Fast, simple SMS without notification overhead
  • πŸ”” Laravel Notifications - Full notification system with queuing and events
  • πŸ”§ Multiple Drivers - SMS driver for production, log driver for testing
  • πŸ—οΈ Clean Architecture - Driver-based design with separation of concerns
  • πŸ›‘οΈ Error Handling - Comprehensive exception handling and validation
  • πŸ“± CLI Support - Send SMS directly from Artisan commands
  • 🌐 REST API - Full HTTP API with rate limiting and authentication
  • πŸ’Ύ Database Persistence - Store SMS messages and recipients in database
  • ⚑ Caching Support - Built-in caching for API responses
  • πŸ§ͺ Testing Ready - Log driver for development and testing
  • βš™οΈ Flexible Configuration - Extensive configuration options
  • πŸ“Š Advanced DTOs - Rich data transfer objects with Arrayable interface
  • 🏷️ Recipient Types - Support for virtual mobile numbers, contacts, and groups
  • πŸ“ Message Tracking - Track SMS messages with unique IDs

πŸš€ Quick Start

Installation

composer require magic-systems-io/laravel-notifyre-sms

Basic Setup

NOTIFYRE_DRIVER=log
NOTIFYRE_API_KEY=your_api_key_here

Basic Usage

use MagicSystemsIO\Notifyre\DTO\SMS\Recipient;
use MagicSystemsIO\Notifyre\DTO\SMS\RequestBody;
use MagicSystemsIO\Notifyre\Enums\NotifyreRecipientTypes;

// Direct SMS (fast)
notifyre()->send(new RequestBody(
    body: 'Hello World!',
    recipients: [new Recipient(NotifyreRecipientTypes::MOBILE_NUMBER->value, '+1234567890')]
));

// With sender
notifyre()->send(new RequestBody(
    body: 'Your order has been shipped!',
    recipients: [new Recipient(NotifyreRecipientTypes::MOBILE_NUMBER->value, '+1234567890')],
    sender: '+1987654321'
));

// Laravel notifications (full features)
$user->notify(new WelcomeNotification());

Test Your Installation

php artisan sms:send --message="Hello from Notifyre!" --recipient="+1234567890"

πŸ“š Documentation

πŸ“– Full Documentation - Complete documentation index and navigation

Quick Links:

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ NotifyreService │───▢│  DriverFactory   │───▢│  SMSDriver      β”‚
β”‚  (Direct SMS)   β”‚    β”‚                  β”‚    β”‚  LogDriver      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                β”‚
                                β–Ό
                       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                       β”‚ NotifyreChannel  β”‚
                       β”‚ (Notifications)  β”‚
                       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                β”‚
                                β–Ό
                       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                       β”‚ HTTP Controllers β”‚
                       β”‚ (REST API)       β”‚
                       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                β”‚
                                β–Ό
                       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                       β”‚ Database Models  β”‚
                       β”‚ (Persistence)    β”‚
                       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ”§ Drivers

  • sms - Sends real SMS via Notifyre API
  • log - Logs SMS to Laravel logs (for testing)

🌐 API Endpoints

The package provides REST API endpoints for SMS operations:

  • POST /api/notifyre/sms - Send SMS messages
  • GET /api/notifyre/sms - List SMS messages (requires sender parameter)
  • GET /api/notifyre/sms/{id} - Get specific SMS message

πŸ“‹ Requirements

  • PHP 8.3+
  • Laravel 12.20+
  • Notifyre API account

πŸ“„ License

MIT License - see LICENSE.md for details.

🀝 Contributing

See CONTRIBUTING.md for contribution guidelines.

πŸ†˜ Support

For issues and questions:

  1. Check the documentation
  2. Review the examples
  3. Open an issue on GitHub

Built with ❀️ for the Laravel community