{"id":49888341,"url":"https://github.com/boxlinknet/kwtsms-laravel","last_synced_at":"2026-05-15T19:33:58.945Z","repository":{"id":344060832,"uuid":"1179505418","full_name":"boxlinknet/kwtsms-laravel","owner":"boxlinknet","description":"Laravel notification channel for the kwtSMS SMS gateway (Kuwait). SMS, OTP, templates, admin panel.","archived":false,"fork":false,"pushed_at":"2026-03-13T04:07:26.000Z","size":179,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-13T04:55:42.983Z","etag":null,"topics":["kuwait","kuwait-sms","kuwaitsms","kwtsms","laravel","notification-channel","otp","sms","sms-api"],"latest_commit_sha":null,"homepage":"https://www.kwtsms.com/integrations.html","language":"Blade","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/boxlinknet.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-12T05:01:56.000Z","updated_at":"2026-03-13T04:07:27.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/boxlinknet/kwtsms-laravel","commit_stats":null,"previous_names":["boxlinknet/kwtsms-laravel"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/boxlinknet/kwtsms-laravel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boxlinknet%2Fkwtsms-laravel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boxlinknet%2Fkwtsms-laravel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boxlinknet%2Fkwtsms-laravel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boxlinknet%2Fkwtsms-laravel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/boxlinknet","download_url":"https://codeload.github.com/boxlinknet/kwtsms-laravel/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boxlinknet%2Fkwtsms-laravel/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33076226,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-15T11:35:32.926Z","status":"ssl_error","status_checked_at":"2026-05-15T11:35:31.362Z","response_time":103,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["kuwait","kuwait-sms","kuwaitsms","kwtsms","laravel","notification-channel","otp","sms","sms-api"],"created_at":"2026-05-15T19:33:58.190Z","updated_at":"2026-05-15T19:33:58.932Z","avatar_url":"https://github.com/boxlinknet.png","language":"Blade","funding_links":[],"categories":[],"sub_categories":[],"readme":"# kwtSMS for Laravel\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/kwtsms/laravel-kwtsms.svg?style=flat-square)](https://packagist.org/packages/kwtsms/laravel-kwtsms)\n[![Total Downloads](https://img.shields.io/packagist/dt/kwtsms/laravel-kwtsms.svg?style=flat-square)](https://packagist.org/packages/kwtsms/laravel-kwtsms)\n[![PHP Version](https://img.shields.io/packagist/php-v/kwtsms/laravel-kwtsms.svg?style=flat-square)](https://packagist.org/packages/kwtsms/laravel-kwtsms)\n[![Code Style](https://img.shields.io/github/actions/workflow/status/boxlinknet/kwtsms-laravel/pint.yml?branch=main\u0026label=code+style\u0026style=flat-square)](https://github.com/boxlinknet/kwtsms-laravel/actions/workflows/pint.yml)\n[![PHP](https://img.shields.io/github/actions/workflow/status/boxlinknet/kwtsms-laravel/php.yml?branch=main\u0026label=php+8.1–8.3\u0026style=flat-square)](https://github.com/boxlinknet/kwtsms-laravel/actions/workflows/php.yml)\n[![License](https://img.shields.io/github/license/boxlinknet/kwtsms-laravel?style=flat-square)](LICENSE)\n\nA Laravel notification channel package for the [kwtSMS](https://www.kwtsms.com) SMS gateway (Kuwait). Send SMS messages through kwtSMS in any Laravel 10/11/12 application.\n\n## About kwtSMS\n\n[kwtSMS](https://www.kwtsms.com) is a Kuwait-based SMS gateway trusted by businesses to deliver messages across Kuwait (Zain, Ooredoo, STC, Virgin) and internationally. It offers private Sender IDs, free API testing, non-expiring credits, and competitive flat-rate pricing. Open a free account in under one minute at [kwtsms.com](https://www.kwtsms.com/signup/), no paperwork or payment required.\n\n---\n\n## Features\n\n- Laravel Notification Channel integration (standard `$user-\u003enotify(...)` syntax)\n- Admin panel at `/kwtsms`: Dashboard, Settings, Templates, Integrations, Logs, Admin Alerts, Help\n- OTP and password reset SMS support with built-in rate limiting\n- Multilingual SMS templates: English and Arabic (RTL ready) with `{{variable}}` placeholders\n- Phone number normalization (strips `+`, `00`, spaces, dashes, Arabic/Hindi digits)\n- Message cleaning (strips emojis, hidden characters, HTML before send)\n- Bulk send with batching (max 200 numbers per request, 0.2s delay between batches)\n- Pre-send balance check (cached, skips API call if zero balance)\n- Coverage-aware sending (skips numbers from inactive country prefixes)\n- Full SMS log in local database with export to CSV and clear/purge option\n- Daily scheduled sync command for balance, sender IDs, and coverage\n- Test mode support (`KWTSMS_TEST_MODE=true`: queued without delivery, credits recoverable)\n- Global on/off kill switch (`KWTSMS_ENABLED=false`)\n- Admin alert notifications (low balance, send failure, daily summary, API errors, OTP flood)\n\n## Requirements\n\n- PHP 8.1+\n- Laravel 10, 11, or 12\n\n## Installation\n\n```bash\ncomposer require kwtsms/laravel-kwtsms\n```\n\nPublish configuration and run migrations:\n\n```bash\nphp artisan vendor:publish --tag=kwtsms-config\nphp artisan vendor:publish --tag=kwtsms-migrations\nphp artisan migrate\n```\n\nOptionally seed the default SMS templates (English + Arabic for all event types):\n\n```bash\nphp artisan db:seed --class=KwtSMS\\\\Laravel\\\\Database\\\\Seeders\\\\KwtSmsDefaultTemplatesSeeder\n```\n\n## Configuration\n\nAdd your kwtSMS API credentials to `.env`:\n\n```env\nKWTSMS_USERNAME=your_api_username\nKWTSMS_PASSWORD=your_api_password\nKWTSMS_SENDER=YOUR-SENDERID\nKWTSMS_TEST_MODE=false\nKWTSMS_ENABLED=true\n```\n\n\u003e **Note:** Use your API username and password from your kwtSMS account API settings page, not your mobile number.\n\n\u003e **Sender ID:** `KWT-SMS` is a shared test sender only. Register a private sender ID on your kwtSMS account before going live. Transactional sender IDs bypass DND lists and are required for OTP delivery.\n\n## Quick Start\n\n### Notification Channel\n\n```php\nuse KwtSMS\\Laravel\\Channels\\KwtSmsChannel;\nuse KwtSMS\\Laravel\\Notifications\\KwtSmsMessage;\n\nclass OrderShipped extends Notification\n{\n    public function via($notifiable): array\n    {\n        return [KwtSmsChannel::class];\n    }\n\n    public function toKwtSms($notifiable): KwtSmsMessage\n    {\n        return KwtSmsMessage::create()\n            -\u003econtent(\"Your order has been shipped. Track: {$this-\u003etrackingCode}\");\n    }\n}\n```\n\nYour notifiable model must implement `routeNotificationForKwtSms()`:\n\n```php\npublic function routeNotificationForKwtSms(): string\n{\n    return $this-\u003ephone; // e.g. \"96598765432\" (international format, digits only)\n}\n```\n\nThen send as normal:\n\n```php\n$user-\u003enotify(new OrderShipped($order));\n```\n\n### Direct Send via SmsSender\n\n```php\nuse KwtSMS\\Laravel\\Services\\SmsSender;\n\n$sender = app(SmsSender::class);\n\n// Single recipient\n$result = $sender-\u003esend('96598765432', 'Hello from kwtSMS!');\n\n// Multiple recipients (batched automatically)\n$result = $sender-\u003esend(['96598765432', '96512345678'], 'Bulk message');\n\n// With event type (used for template lookup and logging)\n$result = $sender-\u003esend('96598765432', 'Your OTP is: 123456', null, [\n    'event_type' =\u003e 'otp',\n]);\n```\n\nResponse format:\n\n```php\n// Success\n['success' =\u003e true, 'message_id' =\u003e 'abc123...', 'numbers_sent' =\u003e 1, 'points_charged' =\u003e 1, 'balance_after' =\u003e 150]\n\n// Failure\n['success' =\u003e false, 'reason' =\u003e 'ERR003', 'error_description' =\u003e 'Authentication error...']\n\n// Blocked by guards\n['success' =\u003e false, 'reason' =\u003e 'disabled']             // KWTSMS_ENABLED=false\n['success' =\u003e false, 'reason' =\u003e 'rate_limited']         // per-IP or per-phone limit exceeded\n['success' =\u003e false, 'reason' =\u003e 'no_balance']           // cached balance is zero\n['success' =\u003e false, 'reason' =\u003e 'no_valid_recipients']  // empty list or all out of coverage\n```\n\n### Sending for Events (Template-Based)\n\n```php\n$sender-\u003esendForEvent('order_placed', '96598765432', [\n    'customer_name' =\u003e 'Ahmed',\n    'order_id' =\u003e '#1234',\n    'total' =\u003e '25.500',\n]);\n```\n\nThis looks up the active template with `event_type = 'order_placed'` and locale matching the user, substitutes `{{customer_name}}`, `{{order_id}}`, `{{total}}`, and sends.\n\n### Facade\n\n```php\nuse KwtSMS\\Laravel\\Facades\\KwtSms;\n\nKwtSms::send('96598765432', 'Hello!');\nKwtSms::balance();\nKwtSms::senderids();\n```\n\n## SMS Templates\n\nTemplates are managed via the admin panel at `/kwtsms/templates`. Each template has:\n- A name (e.g. `otp_en`)\n- An event type (e.g. `otp`, `order_placed`, `password_reset`)\n- A locale (`en` or `ar`)\n- A message body with `{{variable_name}}` placeholders\n\nExample template body:\n\n```\nYour OTP for {{app_name}} is: {{otp_code}}. Valid for {{expiry_minutes}} minutes. Do not share this code.\n```\n\nRendered with:\n\n```php\n$template-\u003erender([\n    'app_name' =\u003e 'MyApp',\n    'otp_code' =\u003e '123456',\n    'expiry_minutes' =\u003e '5',\n]);\n// Output: Your OTP for MyApp is: 123456. Valid for 5 minutes. Do not share this code.\n```\n\nDefault templates are seeded for: `otp`, `password_reset`, `order_placed`, `order_confirmed`, `order_shipped`, `order_delivered`, `order_cancelled`, `order_status`, `cod_otp`, `low_balance_alert`.\n\n## Admin Panel\n\nAfter installation, visit `/kwtsms` to access the admin panel. It provides:\n\n| Tab | Description |\n|-----|-------------|\n| Dashboard | Balance, send statistics, recent logs |\n| Settings | API credentials, test connection, low balance threshold, admin phone |\n| Templates | Create, edit, activate/deactivate SMS templates |\n| Integrations | Toggle which events trigger SMS sends |\n| Logs | View and export the full SMS send history |\n| Admin Alerts | Configure alert notifications to the admin phone |\n| Help | Quick start guide and code examples |\n\n\u003e **Auth:** The admin panel uses the `admin_middleware` setting from `config/kwtsms.php`. Default is `['web', 'auth']`.\n\n## Artisan Commands\n\n```bash\n# Sync balance, sender IDs, and coverage from the kwtSMS API\nphp artisan kwtsms:sync\n\n# Force sync even if recently synced\nphp artisan kwtsms:sync --force\n```\n\nThe sync command runs automatically every day at 03:00 (Asia/Kuwait) via the scheduler.\n\n## Phone Number Format\n\nAll phone numbers must be in international format, digits only, no prefix:\n\n```\n96598765432    correct\n+96598765432   wrong (strip +)\n0096598765432  wrong (strip 00)\n965 9876 5432  wrong (strip spaces)\n```\n\nThe package normalizes numbers automatically before every send. Numbers containing Arabic/Hindi digits are also converted.\n\n## Test Mode\n\nWhen `KWTSMS_TEST_MODE=true`:\n- Messages are queued on kwtSMS servers but not delivered to handsets\n- Credits are not consumed (tentatively held until you delete from the queue)\n- Test messages appear in your kwtSMS account Sending Queue\n- Delete them from the queue at kwtsms.com to release any held credits\n\nAlways use test mode during development. Set `KWTSMS_TEST_MODE=false` only in production.\n\n## Help and Support\n\n- **[kwtSMS FAQ](https://www.kwtsms.com/faq/)**: Answers to common questions about credits, sender IDs, OTP, and delivery\n- **[kwtSMS Support](https://www.kwtsms.com/support.html)**: Open a support ticket or browse help articles\n- **[Contact kwtSMS](https://www.kwtsms.com/#contact)**: Reach the kwtSMS team directly for Sender ID registration and account issues\n- **[API Documentation (PDF)](https://www.kwtsms.com/doc/KwtSMS.com_API_Documentation_v41.pdf)**: kwtSMS REST API v4.1 full reference\n- **[Best Practices](https://www.kwtsms.com/articles/sms-api-implementation-best-practices.html)**: SMS API implementation best practices\n- **[Integration Test Checklist](https://www.kwtsms.com/articles/sms-api-integration-test-checklist.html)**: Pre-launch testing checklist\n- **[Sender ID Help](https://www.kwtsms.com/sender-id-help.html)**: How to register, whitelist, and troubleshoot sender IDs\n- **[kwtSMS Dashboard](https://www.kwtsms.com/login/)**: Recharge credits, buy Sender IDs, view message logs, manage coverage\n- **[Other Integrations](https://www.kwtsms.com/integrations.html)**: Plugins and integrations for other platforms and languages\n\n## License\n\nThe MIT License (MIT). See [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboxlinknet%2Fkwtsms-laravel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fboxlinknet%2Fkwtsms-laravel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboxlinknet%2Fkwtsms-laravel/lists"}