{"id":13744464,"url":"https://github.com/tzsk/sms","last_synced_at":"2026-04-01T21:55:48.382Z","repository":{"id":14593379,"uuid":"76770163","full_name":"tzsk/sms","owner":"tzsk","description":"Laravel SMS Gateway Integration Package","archived":false,"fork":false,"pushed_at":"2025-05-13T23:39:54.000Z","size":1045,"stargazers_count":308,"open_issues_count":5,"forks_count":78,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-05-14T17:08:50.987Z","etag":null,"topics":["aws-sns","clockwork","clockwork-sms","composer","driver","kavenegar","laravel","link-mobility","melipayamak","nexmo","nexmo-sms","sms-gateway","smsir","sns","textlocal","twilio"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tzsk.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"tzsk","custom":"https://paypal.me/KMAhmed"}},"created_at":"2016-12-18T07:54:24.000Z","updated_at":"2025-04-30T04:12:09.000Z","dependencies_parsed_at":"2023-12-31T17:29:17.741Z","dependency_job_id":"9640c2f6-3a07-4619-a938-c77913c4fb75","html_url":"https://github.com/tzsk/sms","commit_stats":{"total_commits":498,"total_committers":25,"mean_commits":19.92,"dds":0.5421686746987953,"last_synced_commit":"b5d29cced5fe5466e64d26d2158d9ad5248c10a4"},"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tzsk%2Fsms","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tzsk%2Fsms/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tzsk%2Fsms/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tzsk%2Fsms/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tzsk","download_url":"https://codeload.github.com/tzsk/sms/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254190396,"owners_count":22029632,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["aws-sns","clockwork","clockwork-sms","composer","driver","kavenegar","laravel","link-mobility","melipayamak","nexmo","nexmo-sms","sms-gateway","smsir","sns","textlocal","twilio"],"created_at":"2024-08-03T05:01:09.957Z","updated_at":"2026-04-01T21:55:48.372Z","avatar_url":"https://github.com/tzsk.png","language":"PHP","readme":"# :gift: Laravel SMS Gateway\n\n![SMS Cover](resources/sms.png)\n\n![GitHub License](https://img.shields.io/github/license/tzsk/sms?style=for-the-badge)\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/tzsk/sms.svg?style=for-the-badge\u0026logo=composer)](https://packagist.org/packages/tzsk/sms)\n[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/tzsk/sms/tests.yml?branch=master\u0026label=tests\u0026style=for-the-badge\u0026logo=github)](https://github.com/tzsk/sms/actions?query=workflow%3ATests+branch%3Amaster)\n[![Total Downloads](https://img.shields.io/packagist/dt/tzsk/sms.svg?style=for-the-badge\u0026logo=laravel)](https://packagist.org/packages/tzsk/sms)\n\nThis is a Laravel Package for SMS Gateway Integration. Now sending SMS is easy and reliable.\n\nList of supported gateways:\n\n-   [AWS SNS](https://aws.amazon.com/sns/)\n-   [Textlocal](http://textlocal.in)\n-   [Twilio](https://www.twilio.com)\n-   [Clockwork](https://www.clockworksms.com/)\n-   [LINK Mobility](https://www.linkmobility.com)\n-   [Kavenegar](https://kavenegar.com)\n-   [Melipayamak](https://www.melipayamak.com)\n-   [Melipayamakpattern](https://www.melipayamak.com)\n-   [Smsir](https://www.sms.ir)\n-   [Tsms](http://www.tsms.ir)\n-   [Farazsms](https://farazsms.com)\n-   [Farazsmspattern](https://farazsms.com)\n-   [SMS Gateway Me](https://smsgateway.me)\n-   [SmsGateWay24](https://smsgateway24.com/en)\n-   [Ghasedak](https://ghasedaksms.com/)\n-   [Sms77](https://www.sms77.io)\n-   [SabaPayamak](https://sabapayamak.com)\n-   [LSim](https://sendsms.az/)\n-   [Rahyabcp](https://rahyabcp.ir/)\n-   [Rahyabir](https://sms.rahyab.ir/)\n-   [D7networks](https://d7networks.com/)\n-   [Hamyarsms](https://hamyarsms.com/)\n-   [SMSApi](https://www.smsapi.si/)\n\n-   Others are under way.\n\n## :package: Install\n\nVia Composer\n\n```bash\n$ composer require tzsk/sms\n```\n\n## :zap: Configure\n\nPublish the configuration file:\n\n```bash\n$ php artisan sms:publish\n```\n\nIn the configuration file, you can set the default driver to use for sending your SMS messages. However, you can also seamlessly change the driver at\nruntime.\n\nChoose the gateway you would like to use for your application. Then, set it as the default driver so that you do not have\nto specify it every time. You can also configure and use multiple gateways within the same project.\n\n```php\n// Eg. if you want to use SNS.\n'default' =\u003e 'sns',\n```\n\nThen fill the credentials for that gateway in the drivers array.\n\n```php\n// Eg. for SNS.\n'drivers' =\u003e [\n    'sns' =\u003e [\n        // Fill all the credentials here.\n        'key' =\u003e 'Your AWS SNS Access Key',\n        'secret' =\u003e 'Your AWS SNS Secret Key',\n        'region' =\u003e 'Your AWS SNS Region',\n        'from' =\u003e 'Your AWS SNS Sender ID', //sender\n        'type' =\u003e 'Tansactional', // Or: 'Promotional'\n    ],\n    ...\n]\n```\n\n#### Textlocal Configuration:\n\nTextlocal is added by default. You simply need to update the credentials in the `textlocal` driver section.\n\n#### AWS SNS Configuration:\n\nIf you want to use AWS SNS, you must install the required composer library first:\n\n```bash\ncomposer require aws/aws-sdk-php\n```\n\n#### Clockwork Configuration:\n\nIf you want to use Clockwork, you must install the required composer library first:\n\n```bash\ncomposer require mediaburst/clockworksms\n```\n\n#### Twilio Configuration:\n\nIf you want to use Twilio, you must install the required composer library first:\n\n```bash\ncomposer require twilio/sdk\n```\n\nThen, simply update the credentials in the `twilio` driver section.\n\n#### Melipayamak or Melipayamakpattern Configuration:\n\nIf you want to use Melipayamak or Melipayamakpattern, you must install the required composer library first:\n\n```bash\ncomposer require melipayamak/php\n```\n\n#### Kavenegar Configuration:\n\nIf you want to use Kavenegar, you must install the required composer library first:\n\n```bash\ncomposer require kavenegar/php\n```\n\n#### SMS Gateway Me Configuration:\n\nIf you want to use SMS Gateway Me, you must install the required composer library first:\n\n```bash\ncomposer require smsgatewayme/client\n```\n\n## :fire: Usage\n\nYou can easily send SMS messages in your application code like this:\n\n```php\n# On the top of the file.\nuse Tzsk\\Sms\\Facades\\Sms;\n\n////\n\n# In your Controller.\nSms::send(\"this message\", function($sms) {\n    $sms-\u003eto(['Number 1', 'Number 2']); # The numbers to send to.\n});\n# OR...\nSms::send(\"this message\")-\u003eto(['Number 1', 'Number 2'])-\u003edispatch();\n\n# If you want to use a different driver.\nSms::via('gateway')-\u003esend(\"this message\", function($sms) {\n    $sms-\u003eto(['Number 1', 'Number 2']);\n});\n# OR...\nSms::via('gateway')-\u003esend(\"this message\")-\u003eto(['Number 1', 'Number 2'])-\u003edispatch();\n\n# Here gateway is explicit : 'twilio' or 'textlocal' or any other driver in the config.\n# The numbers can be a single string as well.\n\n# If you are not a Laravel's facade fan, you can use sms helper:\n\nsms()-\u003esend(\"this message\", function($sms) {\n    $sms-\u003eto(['Number 1', 'Number 2']); # The numbers to send to.\n});\n\nsms()-\u003esend(\"this message\")-\u003eto(['Number 1', 'Number 2'])-\u003edispatch();\n\nsms()-\u003evia('gateway')-\u003esend(\"this message\", function($sms) {\n    $sms-\u003eto(['Number 1', 'Number 2']);\n});\n\nsms()-\u003evia('gateway')-\u003esend(\"this message\")-\u003eto(['Number 1', 'Number 2'])-\u003edispatch();\n\n# Change the from|sender|sim value with from() option:\n\nsms()-\u003evia('gateway')-\u003esend(\"this message\")-\u003efrom('Your From Number | Sender Value | Sim Value ')-\u003eto(['Number 1', 'Number 2'])-\u003edispatch();\n\n# Sending argument and pattern code in pattern drivers such as melipayamakpattern and farazsmspattern.\n\n#Note: The first argument is always known as the pattern code.\n\nsms()-\u003evia('melipayamakpattern')-\u003esend(\"patterncode=123 \\n arg1=name \\n arg2=family\")-\u003eto(['Number 1', 'Number 2'])-\u003edispatch();\n\n```\n\n### Runtime Configuration\n\nYou can override the default gateway configuration at runtime:\n\n```php\n# Override configuration for this specific SMS\nSms::via('gateway')\n    -\u003econfig(['from' =\u003e 'CUSTOM-SENDER'])\n    -\u003esend('this message')\n    -\u003eto(['Number1', 'Number2'])\n    -\u003edispatch();\n```\n\n## :heart_eyes: Channel Usage\n\nFirst, you need to create your notification using the `php artisan make:notification` command. Then, the `SmsChannel::class` can\nbe used as a notification channel like below:\n\n```php\nnamespace App\\Notifications;\n\nuse Tzsk\\Sms\\Builder;\nuse Illuminate\\Bus\\Queueable;\nuse Tzsk\\Sms\\Channels\\SmsChannel;\nuse Illuminate\\Notifications\\Notification;\nuse Illuminate\\Contracts\\Queue\\ShouldQueue;\n\nclass InvoicePaid extends Notification implements ShouldQueue\n{\n    use Queueable;\n\n    /**\n     * Get the notification channels.\n     *\n     * @param  mixed  $notifiable\n     * @return array|string\n     */\n    public function via($notifiable)\n    {\n        return [SmsChannel::class];\n    }\n\n    /**\n     * Get the recipients and body of the notification.\n     *\n     * @param  mixed  $notifiable\n     * @return Builder\n     */\n    public function toSms($notifiable)\n    {\n        return (new Builder)-\u003evia('gateway') # via() is Optional\n            -\u003esend('this message')\n            -\u003eto('some number');\n    }\n}\n```\n\n\u003e **Tip:** You can use the same Builder Instance in the send method.\n\n```php\n$builder = (new Builder)-\u003evia('gateway') # via() is Optional\n    -\u003esend('this message')\n    -\u003eto('some number');\n\nSms::send($builder);\n\n# OR...\n$builder = (new Builder)-\u003esend('this message')\n    -\u003eto(['some number']);\n\nSms::via('gateway')-\u003esend($builder);\n```\n\n#### Custom Made Driver, How To:\n\nFirst, you must define the name of your driver in the drivers array and specify any configuration parameters you need.\n\n```php\n'drivers' =\u003e [\n    'textlocal' =\u003e [...],\n    'twilio' =\u003e [...],\n    'my_driver' =\u003e [\n        ... # Your Config Params here.\n    ]\n]\n```\n\nNext, you need to create a Driver Map Class that will be used to handle sending the SMS. Your driver class simply needs to\nextend `Tzsk\\Sms\\Contracts\\Driver`.\n\nFor example, if you created a class: `App\\Packages\\SMSDriver\\MyDriver`.\n\n```php\n\nnamespace App\\Packages\\SMSDriver;\n\nuse Tzsk\\Sms\\Contracts\\Driver;\n\nclass MyDriver extends Driver\n{\n    /**\n    * You Should implement these methods:\n    *\n    * 1. boot() -\u003e (optional) Initialize any variable or configuration that you need.\n    * 2. send() -\u003e Main method to send messages.\n    *\n    * Note: settings array will be automatically assigned in Driver class' constructor.\n    *\n    * Example Given below:\n    */\n\n    /**\n    * @var mixed\n    */\n    protected $client;\n\n    protected function boot() : void\n    {\n        $this-\u003eclient = new Client(); # Guzzle Client for example.\n    }\n\n    /**\n    * @return object Ex.: (object) ['status' =\u003e true, 'data' =\u003e 'Client Response Data'];\n    */\n    public function send()\n    {\n        $this-\u003erecipients; # Array of Recipients.\n        $this-\u003ebody; # SMS Body.\n\n        # Main logic of Sending SMS.\n        ...\n    }\n\n}\n```\n\nOnce you create this class, you must specify it in the `sms.php` configuration file under the `map` section.\n\n```php\n'map' =\u003e [\n    ...\n    'my_driver' =\u003e App\\Packages\\SMSDriver\\MyDriver::class,\n]\n```\n\n**Note:-** Ensure that the key of the `map` array is exactly identical to the key of the `drivers` array.\n\n## :microscope: Testing\n\n```bash\ncomposer test\n```\n\n## :date: Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## :heart: Contributing\n\nPlease see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.\n\n## :lock: Security Vulnerabilities\n\nPlease review [our security policy](../../security/policy) on how to report security vulnerabilities.\n\n## :crown: Credits\n\n-   [Kazi Ahmed](https://github.com/tzsk)\n-   [All Contributors](../../contributors)\n\n## :policeman: License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","funding_links":["https://github.com/sponsors/tzsk","https://paypal.me/KMAhmed"],"categories":["PHP"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftzsk%2Fsms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftzsk%2Fsms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftzsk%2Fsms/lists"}