{"id":16363006,"url":"https://github.com/dpi/smsframework","last_synced_at":"2026-02-25T20:04:47.137Z","repository":{"id":136996204,"uuid":"42919897","full_name":"dpi/smsframework","owner":"dpi","description":"SMS Framework development. You should be using the repo at Drupal.org instead.","archived":false,"fork":false,"pushed_at":"2025-03-10T13:20:14.000Z","size":2246,"stargazers_count":2,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"4.x","last_synced_at":"2026-01-20T15:47:38.144Z","etag":null,"topics":["drupal","drupal-module","drupal-sms","sms"],"latest_commit_sha":null,"homepage":"https://www.drupal.org/project/smsframework","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dpi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2015-09-22T08:00:13.000Z","updated_at":"2025-03-10T13:20:17.000Z","dependencies_parsed_at":"2025-06-16T03:33:12.582Z","dependency_job_id":"c131f5b9-7109-443a-bb17-7dbe259ca528","html_url":"https://github.com/dpi/smsframework","commit_stats":null,"previous_names":[],"tags_count":42,"template":false,"template_full_name":null,"purl":"pkg:github/dpi/smsframework","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dpi%2Fsmsframework","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dpi%2Fsmsframework/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dpi%2Fsmsframework/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dpi%2Fsmsframework/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dpi","download_url":"https://codeload.github.com/dpi/smsframework/tar.gz/refs/heads/4.x","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dpi%2Fsmsframework/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29837500,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-25T19:08:47.527Z","status":"ssl_error","status_checked_at":"2026-02-25T18:59:04.705Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["drupal","drupal-module","drupal-sms","sms"],"created_at":"2024-10-11T02:26:09.679Z","updated_at":"2026-02-25T20:04:47.121Z","avatar_url":"https://github.com/dpi.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"SMS Framework\n\n# License\n\nThis program is free software; you can redistribute it and/or modify it under\nthe terms of the GNU General Public License as published by the Free Software\nFoundation; either version 2 of the License, or (at your option) any later\nversion.\n\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY\nWARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A\nPARTICULAR PURPOSE. See the GNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License along with\nthis program; if not, write to the Free Software Foundation, Inc., 51 Franklin\nStreet, Fifth Floor, Boston, MA 02110-1301 USA.\n\n# Quick start\n\nThere is no configuration UI, instead we use container parameters.\n\nIn your site directory, usually `sites/default/`, create a `services.yml` file.\n\nAdd to `services.yml`:\n\n```yaml\nparameters:\n  sms.transports:\n    mytransport: 'mytransport://default'\n\n  notifier.channel_policy:\n    urgent: ['sms']\n    high: ['sms']\n    medium: ['sms']\n    low: ['sms']\n```\n\nGo to [Symfony Notifier SMS documentation][symfony-notifier-sms], find your SMS vendor, and copy+paste the _DSN_ in place of `mytransport://default` above. Also execute the `composer require` section found on the same page.\n\nOpen settings.php, add `$settings['container_yamls'][] = __DIR__ . '/services.yml';`\n\nClear cache.\n\nIf you want to know how all this works, or a better explanation, read on.\n\n# Configuration\n\nConfiguration is straightforward.\n\nThere is no UI to configure SMS Framework, instead, you will use YAML. The following will guide you on how to do that.\n\nDepending on your comfort, you can either implement a brand-new module, or add to a sitewide services.yml file (preferred). The following describes how to configure a sitewide services.yml:\n\n## Sitewide YAML**\n\nGo to your site settings directory, usually `sites/default/`.\n\nIn that directory, determine if you have a `services.local.yml` file. If so, you can skip to **YAML** section below.\n\nIf not, you'll need to create a `services.local.yml file` and paste the YAML contents below. Then, in your `settings.php` file, include the file with:\n\n```php\n$settings['container_yamls'][] = __DIR__ . '/services.local.yml';\n```\n## Transport configuration\n\nTransports use DNSs for configuration. A DSN specifies which SMS vendor to use (the protocol part), and the rest is API keys, passwords, etc.\n\nLook up your SMS vendor in the list at [Symfony Notifier SMS documentation][symfony-notifier-sms]. This page shows how to format your DSN.\n\nRun the `composer require` step in order to bring in the integration for your SMS vendor. Then clear your Drupal cache to allow Notifier + SMS to pick up this new integration.\n\n## YAML\n\nAdd the following YAML structure to a YAML file, and change appropriately.\n\n- `mytransport` is a custom name for your transport. Normally this doesn't need to be changed, unless you are routing SMS's to specific vendors in custom code.\n- Change the DSN. Refer to [Symfony Notifier SMS documentation][symfony-notifier-sms].\n- Normally the channel policy can be left as-is, unless you're involving other channels (email, chat, push, etc).\n\n```yaml\nparameters:\n  sms.transports:\n    mytransport: 'fakesms+logger://default'\n\n  notifier.channel_policy:\n    urgent: ['sms']\n    high: ['sms']\n    medium: ['sms']\n    low: ['sms']\n```\n\nAny changes to YAML require a Drupal cache clear.\n\n## General configuration\n\nConfiguration for general SMS Framework features are also provided by container parameters.\n\nConfiguration is optional. Default values can be found in `sms.services.yml`, to\noverride, create a `services.local.yml` per above.\n\n### Entity Mapping\n\nThe `notifier.field_mapping.sms` parameter allows mapping entity fields as phone number source data.\n\n```yaml\n  notifier.field_mapping.sms:\n    - entity_type: user\n      bundle: user\n      field_name: my_phone_number_field\n      verifications: true\n```\n\n### SMS Verification settings\n\nThe `sms.verification` parameter provides general settings for verifications.\n\nSee `sms.services.yml` for documentation.\n\n```yaml\n  sms.verification:\n    enabled: true\n    route:\n      path: '/verify'\n      success: '/user'\n    unique: true\n    unverified:\n      lifetime: 900\n      purge_fields: true\n    message: |-\n      Your verification code is '[sms-message:verification-code]'.\n      Go to [sms:verification-url] to verify your phone number.\n      - [site:name]\n```\n\nChanging `enabled` to false will also remove relevant verification services\nfrom the container.\n\n## Testing\n\nThe special _Fake SMS_ integration is able to send SMS to logger or email.\n\nTo install this integration, run the `composer require symfony/fake-sms-notifier` step, per [Symfony Notifier SMS documentation][symfony-notifier-sms].\n\nThen configure the DSN in YAML with either `fakesms+logger` or `fakesms+email` protocol.\n\n# API\n\nSending an SMS programmatically is quite simple:\n\n - Construct the recipient\n - Construct the message\n - Send the combined notification\n\n**Recipient**\n\nCreate a recipient. A recipient is any object that implements `\\Symfony\\Component\\Notifier\\Recipient\\RecipientInterface`.\n\nThough usually you'd want to implement something slightly more specific. A recipient that can receive SMS needs to extend `\\Symfony\\Component\\Notifier\\Recipient\\SmsRecipientInterface`.\n\nIf your project makes use of _Bundle classes_, you can consider implementing a user bundle class. Then making this bundle class implement `\\Symfony\\Component\\Notifier\\Recipient\\SmsRecipientInterface` !.\n\n```php\n$recipient = new \\Symfony\\Component\\Notifier\\Recipient\\Recipient(\n  email: 'hello@example.com',\n  phone: '+123123123',\n);\n```\n\nA phone number does not have any specific formatting. It just needs to be a non-empty string. Phone numbers are validated by your chosen SMS vendor. If you want to validate phone numbers, you may use the utilities implemented by [Telephone Validation][telephone-validation].\n\n**Message**\n\n```php\n$notification = (new \\Symfony\\Component\\Notifier\\Notification\\Notification())\n  -\u003esubject('Test message');\n```\n\n**Send**\n\nSend the message through the Notifier service.\n\nThe notifier service is autowired with `\\Symfony\\Component\\Notifier\\NotifierInterface`.\n\n```php\nfinal class MyController {\n\n  function __construct(\n    private readonly \\Symfony\\Component\\Notifier\\NotifierInterface $notifier,\n  ) {}\n\n  function __invoke(){\n    // Send the $notification to the $recipient.\n    $this-\u003enotifier-\u003esend($notification, $recipient);\n\n    // `send` method accepts any number of recipients. E.g:\n    $this-\u003enotifier-\u003esend($notification, recipients: $recipient1, $recipient2, $recipient3);\n  }\n\n}\n```\n\nFurther documentation for _Sending_ can be found in https://symfony.com/doc/current/notifier.html#creating-sending-notifications\n\n# Messenger (i.e, Queues)\n\nWhen Symfony Messenger is available (via [SM project][drupal-symfony-messenger]), messages will be dispatched asynchronously, i.e. via a queue.\n\nNo manual configuration is required. Messenger is setup and configured automatically.\n\n---\n\n- [drupal-symfony-messenger]: https://www.drupal.org/project/sm\n- [symfony-notifier-sms]: https://symfony.com/doc/current/notifier.html#sms-channel\n- [telephone-validation]: https://drupal.org/project/telephone_validation\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdpi%2Fsmsframework","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdpi%2Fsmsframework","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdpi%2Fsmsframework/lists"}