sysborg / kingsms
Integração simples com a API da KingSMS para laravel
1.0.8.2
2025-03-30 03:28 UTC
Requires
- php: >=8.0
- laravel/framework: >=9.0
- laravel/sanctum: >=2.11
README
Easily integrate KingSMS into your Laravel application.
This package simplifies the process of sending SMS, retrieving reports, checking balance, and receiving replies using the KingSMS API.
📦 Installation
Install the package via Composer:
composer require sysborg/kingsms
The service provider is auto-discovered by Laravel, so no need to manually add it to config/app.php
.
⚙️ Configuration
Add your KingSMS credentials to your .env
file:
KINGSMS_URL=https://painel.kingsms.com.br/kingsms/api.php KINGSMS_LOGIN=your_login KINGSMS_TOKEN=your_token
The default API URL is already set, but you can override it if needed.
🚀 Usage
Send SMS
use Facades\Sysborg\KingSMS\Services\KingSMS; $response = KingSMS::sendSMS( '5598999999999', // Recipient phone number 'Your message goes here', // Message content 'Optional Campaign Name', 'Optional Date (dd/mm/yyyy)', 'Optional Time (hh:mm)' );
Get SMS Report
$response = KingSMS::getRelatorio('your_sms_id');
Check Balance
$response = KingSMS::getSaldo();
Get SMS Replies
$response = KingSMS::getResposta('read'); // or 'unread'
🔔 Using as Notification Channel
You can also send SMS using Laravel's notification system.
Add toKingsms()
method in your Notification:
public function via($notifiable) { return ['kingsms']; } public function toKingsms($notifiable) { return 'This is your notification message'; }
Ensure your notifiable entity has a phone
attribute or method.
🔗 Useful Links
👨💻 Author
Developed and maintained by:
Anderson Arruda
📧 andmarruda@gmail.com
Also maintained by:
Sysborg
📧 contato@sysborg.com.br