Download the PHP package pratiksahu2003/smscountry-php-sdk without Composer
On this page you can find all versions of the php package pratiksahu2003/smscountry-php-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download pratiksahu2003/smscountry-php-sdk
More information about pratiksahu2003/smscountry-php-sdk
Files in pratiksahu2003/smscountry-php-sdk
Package smscountry-php-sdk
Short Description Official-style PHP SDK for SMS Country bulk SMS API. Works with plain PHP, Laravel, Symfony, and any PHP framework.
License MIT
Informations about the package smscountry-php-sdk
SMS Gateway (SMSCountry) — PHP SDK
Package:
pratiksahu2003/smscountry-php-sdk
Version:1.0.0
Last updated: 24 June 2026
Author: Pratik Sahu · [email protected]
Repository: github.com/Pratiksahu2003/smscountry-php-sdk
API reference: SMS Country HTTP API Documentation
Framework-agnostic PHP Composer library to send SMS, check balance, fetch delivery reports, and store every attempt in a database log table. Works in plain PHP, Laravel, Symfony, CodeIgniter, WordPress, and any PHP project.
Table of contents
- Features
- Requirements
- Installation
- Environment variables
- Quick setup (.env)
- Database log table
- Implementation guides
- Plain PHP / Core PHP
- Laravel
- CodeIgniter 4
- Symfony
- WordPress / WooCommerce
- Sending SMS
- Balance & delivery reports
- Delivery webhook callback
- Message types
- Delivery status codes
- Troubleshooting
- Development & testing
- License
Features
| Feature | Description |
|---|---|
| Single SMS | Send to one mobile number |
| Bulk SMS | Same message to many numbers |
| Personalized SMS | Different message per number in one API call |
| Credit balance | Check remaining SMS credits |
| Delivery reports | Pull reports by date range |
| Auto country code | Prefix local numbers with SMS_COUNTRY_DEFAULT_COUNTRY_CODE |
| Database logging | Every send logged to smscountry_logs |
| Laravel ready | Auto-discovery, migration, Eloquent model, Facade |
| Webhook handler | Update delivery status from SMS Country callback |
Requirements
| Requirement | Version |
|---|---|
| PHP | 8.1 or higher |
| Guzzle HTTP | 7.x (installed via Composer) |
| Database | MySQL / MariaDB / PostgreSQL (for SMS logs) |
| PDO extension | Required for plain PHP logging |
| Laravel | 10+ (optional, for Laravel integration) |
Installation
Environment variables
Use these variables in any PHP project. They are the standard configuration for the SMS Country gateway.
| Variable | Required | Example | Description |
|---|---|---|---|
SMS_COUNTRY_AUTH_KEY |
Yes | myaccount |
SMS Country username (API param: User) |
SMS_COUNTRY_AUTH_TOKEN |
Yes | your_secret_password |
SMS Country password (API param: passwd) |
SMS_COUNTRY_BASE_URL |
No | https://api.smscountry.com |
API base URL (endpoints are built from this) |
SMS_COUNTRY_SENDER_ID |
No | SUGNTA |
Approved sender ID (API param: sid) |
SMS_COUNTRY_DEFAULT_COUNTRY_CODE |
No | 91 |
Auto-prefix local numbers (India = 91) |
SMS_COUNTRY_DELIVERY_REPORT |
No | true |
Request delivery report (DR=Y) |
SMS_COUNTRY_ENCODE_MESSAGES |
No | true |
Encode special HTTP characters in message |
SMS_COUNTRY_LOGGING |
No | true |
Save every SMS to database log table |
SMS_COUNTRY_LOGS_TABLE |
No | smscountry_logs |
Custom log table name |
Legacy aliases (still supported):
SMSCOUNTRY_USERNAME,SMSCOUNTRY_PASSWORD,SMSCOUNTRY_SENDER_ID
How credentials map to the API
Quick setup (.env)
Copy this into your project .env file and replace with your real credentials from SMS Country:
Mobile number examples with SMS_COUNTRY_DEFAULT_COUNTRY_CODE=91:
| You send | API receives |
|---|---|
9876543210 |
919876543210 |
09876543210 |
919876543210 |
919876543210 |
919876543210 (unchanged) |
+91 98765 43210 |
919876543210 |
Database log table
When logging is enabled, every SMS is stored in smscountry_logs.
Create table — plain SQL
Or run manually from database/schema/smscountry_logs.sql.
Create table — Laravel
Log table columns
| Column | Type | Description |
|---|---|---|
id |
BIGINT | Auto-increment primary key |
job_id |
VARCHAR(64) | Message ID from API response OK:515789649 |
mobile_number |
VARCHAR(255) | Destination number(s) with country code |
message |
TEXT | SMS body sent |
sender_id |
VARCHAR(32) | Sender ID used (SUGNTA) |
message_type |
VARCHAR(8) | N, LNG, OL, etc. |
delivery_report |
BOOLEAN | Whether DR was requested |
send_type |
ENUM | single, bulk, multiple |
status |
ENUM | pending → sent or failed |
api_response |
TEXT | Raw API response |
error_message |
TEXT | Error text on failure |
delivery_status |
TINYINT | 0–11 delivery code |
delivery_status_label |
VARCHAR(64) | Human-readable delivery status |
delivered_at |
DATETIME | Delivery timestamp |
created_at / updated_at |
DATETIME | Timestamps |
Implementation guides
1. Plain PHP / Core PHP
Step 1 — Install
Step 2 — Set environment variables (Apache/Nginx, .env loader, or server config)
Step 3 — Create log table
Step 4 — Send SMS
Step 5 — Check balance
2. Laravel
Step 1 — Install
Step 2 — Add to .env
Step 3 — Publish config & migration
Step 4 — Send via Facade
Step 5 — Inject in a Service / Controller
Step 6 — View SMS logs
3. CodeIgniter 4
.env
app/Config/Services.php
Controller
4. Symfony
.env
config/services.yaml
Usage in a service
5. WordPress / WooCommerce
wp-config.php or plugin .env
Plugin snippet
Sending SMS
Single SMS
Bulk SMS (same message, many numbers)
Personalized SMS (different message per number)
With custom sender ID per call
Balance & delivery reports
Check SMS credit balance
API endpoint: {BASE_URL}/SMSCwebservice_User_GetBal.asp
Fetch delivery reports (auto-updates log table)
API endpoint: {BASE_URL}/smscwebservices_bulk_reports.aspx
Delivery webhook callback
Register your callback URL with SMS Country. When a delivery update arrives, handle it like this:
Plain PHP
Laravel route
Message types
Per official API documentation:
| PHP Enum | API mtype |
Use case |
|---|---|---|
MessageType::Normal |
N |
Standard text SMS (max 160 chars) |
MessageType::Unicode |
LNG |
Unicode — Arabic, Hindi, Chinese, etc. (max 70 chars) |
MessageType::Hexadecimal |
OL |
Hex-encoded Unicode content |
MessageType::Ringtone |
R |
Ringtone messages |
MessageType::Picture |
P |
Picture messages |
MessageType::Logo |
L |
Logo messages |
MessageType::Flash |
F |
Flash SMS |
MessageType::WapPush |
WP |
WAP push |
MessageType::LongSms |
LS |
Long SMS (multi-part) |
Delivery status codes
| Code | Status | Meaning |
|---|---|---|
0 |
Queued | Message in queue |
1 |
SubmittedToCarrier | Submitted to carrier |
2 |
Undelivered | Not delivered |
3 |
Delivered | Successfully delivered |
4 |
Expired | Message expired |
8 |
Rejected | Rejected by gateway |
9 |
Sent | Message sent |
10 |
OptedOut | Number opted out |
11 |
InvalidMobile | Invalid mobile number |
Use in PHP:
Troubleshooting
| Error / Issue | Cause | Fix |
|---|---|---|
Invalid User Name!! |
Wrong SMS_COUNTRY_AUTH_KEY |
Verify username in SMS Country account |
Invalid Password!! |
Wrong SMS_COUNTRY_AUTH_TOKEN |
Reset password in account panel |
Insufficient Balance!!! |
No SMS credits | Top up at smscountry.com |
Invalid mobile number(s) |
Missing country code | Set SMS_COUNTRY_DEFAULT_COUNTRY_CODE=91 |
| SMS not delivered | Unapproved sender ID | Use approved ID or set SMS_COUNTRY_SENDER_ID=SUGNTA |
| Special chars broken | Encoding issue | Keep SMS_COUNTRY_ENCODE_MESSAGES=true |
| No log in database | Logging disabled | Set SMS_COUNTRY_LOGGING=true and run migration |
Common API response formats
Development & testing
Package info
| Item | Value |
|---|---|
| Author | Pratik Sahu · [email protected] |
| Repository | Pratiksahu2003/smscountry-php-sdk |
| Package | pratiksahu2003/smscountry-php-sdk |
| Namespace | SMSCountry\ |
| Version | 1.0.0 |
| PHP | ^8.1 |
| License | MIT |
License
MIT — see LICENSE.
Author & support: Pratik Sahu · [email protected] · Report an issue
SMS Country API: Developers · API Documentation