{"id":37262180,"url":"https://github.com/tpg/smsportal","last_synced_at":"2026-01-15T23:14:53.127Z","repository":{"id":57856216,"uuid":"528577714","full_name":"tpg/smsportal","owner":"tpg","description":"Complete SMSPortal Rest API client for Laravel","archived":false,"fork":false,"pushed_at":"2023-04-18T14:47:33.000Z","size":18,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-01-14T13:55:35.718Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/tpg.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-08-24T20:06:50.000Z","updated_at":"2022-09-08T05:00:40.000Z","dependencies_parsed_at":"2022-08-31T18:01:30.648Z","dependency_job_id":null,"html_url":"https://github.com/tpg/smsportal","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/tpg/smsportal","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpg%2Fsmsportal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpg%2Fsmsportal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpg%2Fsmsportal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpg%2Fsmsportal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tpg","download_url":"https://codeload.github.com/tpg/smsportal/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpg%2Fsmsportal/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28473974,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-15T22:27:41.514Z","status":"ssl_error","status_checked_at":"2026-01-15T21:54:47.910Z","response_time":62,"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":[],"created_at":"2026-01-15T23:14:52.554Z","updated_at":"2026-01-15T23:14:53.121Z","avatar_url":"https://github.com/tpg.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SMSPortal client for Laravel\n\n[![Tests](https://github.com/tpg/smsportal/actions/workflows/tests.yml/badge.svg)](https://github.com/tpg/smsportal/actions/workflows/tests.yml)\n\nThis library provides a complete implementation of the SMSPortal Rest API for Laravel. The library provides a generic client you can use to send SMSs and a Laravel Notifications Channel which can be used to easily send SMSs to specific entities.\n\nInstallation through Composer:\n\n```shell\ncomposer require thepublicgood/smsportal\n```\n\nOnce installed, publish the config file with:\n\n```shell\nphp ./artisan vendor:publish --provider=\"TPG\\\\SMSPortal\\\\SMSPortalServiceProvider\"\n```\n\nThis will place a simple `smsportal.php` file in your config directory. However, if you don't want to publish the provided config file, you can also alter the provided `services.php` config file with:\n\n```php\nreturn [\n\n    //...\n    \n    'smsportal' =\u003e [\n        'id' =\u003e env('SMSPORTAL_ID'),\n        'secret' =\u003e env('SMSPORTAL_SECRET'),\n    ],\n\n];\n```\n\nConfigure your SMSPortal API ID and Secret in either the `services.php` or `smsportal.php` config file. \n\n## Basic usage\nThe library provides a Laravel facade to easily send arbitrary messages to one or more mobile numbers:\n\n```php\nSMSPortal::to('27823456789')-\u003emessage('Hello, World!')-\u003esend();\n```\n\nYou can also send the same message to multiple numbers by passing in an array:\n\n```php\nSMSPortal::to(['27823456789', '278209876543'])-\u003emessage('Hello, all of you!')-\u003esend();\n```\n\n## Advanced usage\nIf you need more control over who received what, the library has registered the `SMSPortalClient` interface into the Laravel container. You can create `Message` objects and pass them to the `sendBulk` method:\n\n```php\nuse TPG\\SMSPortal\\Contracts\\SMSPortalClient;\nuse TPG\\SMSPortal\\Message;\n\npublic function sms(SMSPortalClient $client)\n{\n    $message1 = new Message('27823456789', 'Message number 1');\n    $message2 = new Message('27829876543', 'Message number 2');\n    \n    $response = $client-\u003esendBulk([$message1, $message2]);\n}\n```\n\nYou can also use the `send` message to send a single message:\n\n```php\n$response = $client-\u003esend($message);\n```\n\n## SMSPortal groups\nIf you've set up groups on contacts through SMSPortal, you can send a single message to the groups your choice by using the `sendGroup` method:\n\n```php\nuse TPG\\SMSPortal\\Contracts\\SMSPortalClient;\nuse TPG\\SMSPortal\\Message;\n\npublic function sms(SMSPortalClient $client)\n{\n    $response = $client-\u003esendGroup('Hello, all of you groups!', ['group1', 'group2']);\n}\n```\n\n## Laravel Notifications\nIf you want to use SMSPortal through Laravel Notifications, create a new `Notification` class and add `smsportal` to the array returned by the `via` method:\n\n```php\nuse TPG\\SMSPortal\\SMSPortalChannel;\n\npublic function via($notifiable): array\n{\n    return [\n        'smsportal',\n    ]\n}\n```\n\nThen define a `toSMSPortal` method on the notification and return a message `string`:\n\n```php\npublic function toSMSPortal($notifiable): string\n{\n    'Hello, '.$notifiable-\u003ename;\n}\n```\n\nOn the notifiable class (your `User` class, for example) define a `routeNotificationForSMSPortal` method that returns the correct mobile number to send to:\n\n```php\npublic function routeNotificationForSmsPortal(Notification $notification): string\n{\n    return $this-\u003emobile;\n}\n```\n\n## Sending options\nThe library also provides a way to pass SMSPortal sending options. You can create a new instance of `SendOptions` and pass in any option you need. Pass this as the last parameter of the `send`, `sendBulk` or `sendGroup` methods:\n\n```php\nuse TPG\\SMSPortal\\Contracts\\SMSPortalClient;\nuse TPG\\SMSPortal\\Message;\n\npublic function sms(SMSPortalClient $client)\n{\n    $options = new SendOptions(\n        allowContentTrimming: true,\n        shortenUrls: true,\n    );\n\n    $response = $client-\u003esend($message, $options);\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftpg%2Fsmsportal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftpg%2Fsmsportal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftpg%2Fsmsportal/lists"}