SMS Framework
This module allows Drupal sites to send SMS messages through various providers. It also supports verifying user phone numbers before sending messages.
SMS Framework is an implementation of Symfony Notifiers' SMS component.
Many service integrations are provided, including: 46elks, AllMySms, Amazon SNS, Bandwidth, Brevo, Clickatell, ContactEveryone, Esendex, Fake SMS (for testing), FreeMobile, GatewayApi, GoIP, Infobip, Iqsms, iSendPro, KazInfoTeh, LightSms, LOX24, Mailjet, MessageBird, MessageMedia, Mobyt, Nexmo, Octopush, OrangeSms, OvhCloud, Plivo, Primotexto, Redlink, RingCentral, Sendberry, Sendinblue, Sms77, SimpleTextin, Sinch, Sipgate, SmsSluzba, Smsapi, Smsbox, SmsBiuras, Smsc, SMSense, SMSFactor, SpotHit, Sweego, Telnyx, TurboSms, Twilio, Unifonic, Vonage, Yunpian.
The dispatch of messages, including the mapping of recipients to users is provided by Notifier. Notifier and Messenger provide a way to send messages asynchronously (i.e, queues; outside of the web request). Its also possible to implement your own SMS service, or customise any of the services provided by Symfony by implementing Texter services.
SMS Framework provides other SMS related features, such as
- verified user/entity concepts
- Only sending messages to a user if it has been verified.
- Verification message with random code generator, and associated page to verify the code.
- Getting phone numbers for a user (or any other entity)
- Mapping phone numbers to a user (or any other entity)
API examples
// Sending to a user/entity.
/** @var \Drupal\sms\PhoneNumber\SmsPhoneNumberInterface $phoneNumberService */
$phoneNumberService = \Drupal::service(\Drupal\sms\PhoneNumber\SmsPhoneNumberInterface::class);
$user = User::load(1);
$notification = (new Notification())->subject('Test message');
$phoneNumberService->send($user, $notification)
Or directly to a phone number:
// Sending to a user/entity.
/** @var \Symfony\Component\Notifier\NotifierInterface $notifier */
$notifier = \Drupal::service(\Symfony\Component\Notifier\NotifierInterface::class);
$recipient = new \Symfony\Component\Notifier\Recipient\Recipient(
phone: '+123123123',
);
$notification = (new Notification())->subject('Test message');
$notifier->send($notification, $recipient);
Support #
Support is provided in the issue queue or Drupal Slack in the #sms channel.
Installation #
Download the project with composer require drupal/sms. Non-Composer installations are strictly not supported.
Versions
Version 4
New users of the project or users seeking new features should use Version 4. Version 4 is a complete architecture of the project and is a better choice for long term support and technical resilience.
Version 2
The latest version of v2 permits Drupal 10 and 11. v3 and v4 permit Drupal 11 and later only. v2 is unsupported.
Version 2 users should upgrade to V3 for long term support. V3 primarily includes changes to PHP typing and class finalization. There is no long term plan for V3 support as yet, so please evaluate Version 4 at your earliest convenience.
A list of changes for users upgrading from 2 to 3, and new 4 users can be found at https://www.drupal.org/project/smsframework/issues/3492832.
Upgrading from v2/3 to v4
When upgrading from version 2 or 3 to 4, you must uninstall the project first. There is no automatic upgrade path. Gateway integration and configuration will need to be converted to the new services. Entity/user verification carry forward as there are no schema changes. Take a table dump of the sms verification table before uninstalling, then re-import the data.
Integrations
- Telephone Validation as a solution to ensuring phone number field data is in the correct format.
- Symfony Messenger for queue / asynchronous capabilities.
Depends on
Dependencies of the latest stable release
No dependencies recorded for this project.
Required by
3 tracked projects depend on this one
- Bulkgate SMS 18 sites
- Strex SMS 8 sites
- SMSFactor for SMS Framework 7 sites
Activity
Release Timeline
Releases
| Version | Type | Core | Notes | Release date | |
|---|---|---|---|---|---|
| 4.0.0-beta1 | Pre-release | 11 | ✨ SMS Framework V4, rewrite as a component of Symfony Notifier/Texter | Mar 5, 2025 | |
| 4.x-dev | Dev | 11 | Feb 25, 2025 | ||
| 3.0.0-alpha1 | Pre-release | 11 | Dec 16, 2024 | ||
| 3.0.x-dev | Dev | 11 | Major breaking interface changes. | Dec 10, 2024 | |
| 2.3.0 | Stable | 10–11 | Transitional release, compatible with Drupal 10.3 and 11 | Dec 9, 2024 | |
| 2.4.0 | Stable | 11 | Compatible with Drupal 11 and above, Linting and CI updates | Dec 9, 2024 | |
| 2.4.x-dev | Dev | 11 | Drupal 11 and later compat | Dec 4, 2024 |