Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Fast2Sms Laravel Package

itxshakil/laravel-fast2sms

Laravel Fast2SMS is a complete Fast2SMS integration for Laravel, supporting SMS, OTP, DLT, and WhatsApp with a fluent, type-safe API. It includes Laravel Notifications, queue support, a powerful fake for testing, typed exceptions, and cost-saving safeguards.

View on GitHub
Deep Wiki
Context7
v2.2.1

Fixed

  • Fast2sms::fake() recorded SMS parameters now carry every field of the payload. Previously sentSms()[n]->parameters only had numbers, message and route, so OTP and DLT sends showed a blank message and null for variablesValues, senderId, entityId, templateId, language, flash and scheduleTime. Tests can now read the OTP code via ->parameters->variablesValues and assert on DLT fields.

[2.2.0] - 2026-09-24

Full changelog: https://github.com/itxshakil/laravel-fast2sms/compare/v2.2.0...v2.2.1

v2.0.0

🚀 What's New in v2.0.0

This is a major release of laravel-fast2sms focused on WhatsApp Business API support, a richer exception hierarchy, expressive testing utilities, and modern PHP 8.3+ patterns throughout.

⚠️ This release contains breaking changes. Please read the Upgrade Guide before updating.


Highlights

🚀 WhatsApp Business API — Send text, image, document, location, interactive, reaction, sticker, and template messages via Fast2sms::viaWhatsApp().

🔔 Laravel Notification Channels — Drop-in SmsChannel and WhatsAppChannel for use with Laravel's built-in notification system.

🧱 Typed Exception Hierarchy — Catch exactly what you need: AuthenticationException, RateLimitException, ServerException, NetworkException, ValidationException, ConfigurationException, DuplicateSendException, InsufficientBalanceException, ThrottleExceededException.

🧪 Rich Fake Assertions — 16 new Fast2smsFake assertion methods for expressive, readable test code. Plus stopFaking() for clean test teardown.

💡 Fluent Message Builders — SmsMessage and WhatsAppMessage with named constructors and chainable setters. SmsMessage also ships with credit helpers: charCount(), isUnicode(), creditCount(), exceedsOneSms().

⚙️ New Artisan Commands

  • fast2sms:events — lists all dispatchable events with descriptions
  • fast2sms:ide-helper — generates _ide_helper_fast2sms.php for full IDE autocompletion

📦 Queue Support — onQueue() / onConnection() fluent API with built-in validation.

🧩 PHP 8.3+ Patterns — readonly class DTOs, backed enums, and typed returns throughout.

🐘 PHP 8.4 & 8.5 Support — CI matrix extended and fully tested.

🌐 Laravel 13 Support — Compatible with Laravel 11, 12, and 13.


Cost-Saving Guards (all opt-in via config/env)

Guard Config Key What it does
Recipient deduplication fast2sms.recipients.deduplicate Strips duplicate numbers before every send
Invalid recipient stripping fast2sms.validation.strip_invalid_recipients Validates numbers, logs warnings, throws if all invalid
Idempotency guard fast2sms.deduplication.* Blocks repeated (recipients + message + route) within a TTL window
Rate throttle fast2sms.throttle.* Sliding-window per-minute cap via Laravel cache
Balance gate fast2sms.balance_gate.* Checks wallet before send; fires LowBalanceDetected, optionally throws
Batch splitting fast2sms.recipients.batch_size Splits large recipient lists into chunks automatically

Breaking Changes ⚠️

Fast2smsException is now final Extend a specific subtype (ApiException, NetworkException, etc.) instead.

DTOs are readonly class Fast2smsConfig, SmsParameters, and WhatsAppParameters properties cannot be mutated after construction — reconstruct the DTO instead.

ConfigValidator::validate() now throws ConfigurationException instead of \InvalidArgumentException — update your catch blocks.

ResponseFactory throws ApiException on unknown response types instead of UnhandledMatchError.

Fast2smsFake recorded calls are typed value objects Use sentSms() / sentWhatsApp() accessors instead of accessing $fake->recorded directly.

SmsChannel / WhatsAppChannel throw \LogicException when the notifiable is missing the required routing method — implement routeNotificationForFast2sms() / routeNotificationForWhatsapp().

All public API methods now return ResponseInterface instead of the concrete Fast2smsResponse — update type-hints accordingly.

The public sending API — Fast2sms::quick(), ::dlt(), ::otp(), ::viaWhatsApp() — is completely unchanged.


Deprecations

These methods still work but will be removed in v3.0.0:

Deprecated Replacement
SmsMessage::content() SmsMessage::withContent()
SmsMessage::route() SmsMessage::withRoute()
SmsMessage::to() SmsMessage::withNumbers()

Bug Fixes

  • HttpClient no longer retries on 4xx — only 5xx and connection failures
  • ResponseFactory no longer throws UnhandledMatchError on unknown response types
  • ManagesSms::setDlt no longer overwrites the message body with the DLT template ID
  • HttpClient::upload now guards against missing or unreadable files with a descriptive exception
  • SendRateThrottle replaced non-atomic cache pattern with RateLimiter to eliminate a race condition
  • AppliesSendGuards writes the dedup cache only after a successful send, so failed sends don't block retries
  • Fast2smsServiceProvider::boot now correctly skips config validation only during unit tests, not all console commands
  • ManagesWhatsAppActions dispatches WhatsAppFailed on exception
  • LowBalanceDetected now correctly uses Dispatchable + SerializesModels
  • Null-dereference on first-chunk failure in ManagesSms::executeSend is now a descriptive Fast2smsException
  • Double afterApiCall() trigger in executeApiCall finally block removed

Test Coverage

v1.x v2.0.0
Tests 88 229
Assertions — 453

New coverage includes DTOs, enums, exceptions, responses, events, jobs, channels, fake assertions, and LogClient.


Upgrade Guide

See UPGRADING.md for a step-by-step migration guide from v1.x to v2.0.0.


Full Changelog: https://github.com/itxshakil/laravel-fast2sms/blob/main/CHANGELOG.md

v1.3.0
  • Observability & Logging:
    • Optional database-backed logging system with fast2sms_logs table.
    • New LogSmsSent and LogSmsFailed event listeners.
    • log driver for local development to prevent credit wastage.
  • Resilience:
    • Automatic retries using Laravel's Http::retry() (3 attempts, 100ms backoff).
    • Config validation during boot with clear Fast2smsException.
  • Developer Experience (DX):
    • Enhanced SmsChannel to support SmsMessage objects with recipient data.
    • Fluent to() and send() methods in SmsMessage.
    • Support for Laravel Collection in to() method.
    • Custom Fast2smsPhone validation rule for Indian mobile numbers.
    • Improved Fast2smsResponse with dynamic property access and json() method.
  • Testing:
    • Added comprehensive tests for database logging, log driver, retries, config validation, and the new validation rule.
v1.1.0

What's Changed

Full Changelog: https://github.com/itxshakil/laravel-fast2sms/compare/v1.0.0...v1.1.0

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
socialdept/atp-orm
cboxdk/laravel-assistant-client
socialdept/atp-resolver
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings
coleus/apps
seampact/laravel
emmyconceptng/laravel-ng-postcode
jjsquady/round-robin