Download the PHP package dreamsms/laravel-dreamsms without Composer
On this page you can find all versions of the php package dreamsms/laravel-dreamsms. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download dreamsms/laravel-dreamsms
More information about dreamsms/laravel-dreamsms
Files in dreamsms/laravel-dreamsms
Package laravel-dreamsms
Short Description A Laravel package providing a fluent, easy-to-use wrapper around the DreamSMS API for user registration, token management, sender configuration, balance inquiry and sending single or multi-recipient SMS messages. Developed by هوية الأحلام لتقنية المعلومات (Dreams), Saudi Arabia’s leading creative & tech service provider since 2006.
License MIT
Homepage https://github.com/YacoubAl-haidari/laravel-dreamsms
Informations about the package laravel-dreamsms
Laravel DreamSMS Package Documentation
Comprehensive reference for every method provided by the dreamsms/laravel-dreamsms
package.
1. Installation & Configuration
1.1 Install via Composer
1.2 Publish Configuration
1.3 Environment Variables
Add these to your .env
:
1.4 Config File (config/dreamsms.php
)
How To Get Sender Name, Account Username, client_secret, and client_id
1. Account Username
Your Account Username is the username you use to log in to your Dreams account.
2. client_id
To obtain your client_id:
-
Visit the following URL:
- Copy the displayed client_id.
3. client_secret
To retrieve your client_secret:
-
Go to your profile page:
- Copy your client_secret from the information displayed there.
4. Sender Name
To get your default Sender Name:
-
Navigate to:
- Identify and copy the default Sender Name from your listed sender names.
2. Service Usage
Use the Facade or inject the DreamSms
service.
3. API Methods Reference
Each section details endpoint, parameters, expected response, and Laravel usage.
3.1 register(array $user): array
Description: Register a new DreamSMS user account.
HTTP Method | Endpoint |
---|---|
POST | /Register |
Parameters
Name | Type | Required | Description |
---|---|---|---|
user | string | yes | Desired username |
password | string | yes | Password (min 6 chars) |
name | string | yes | Full name |
mobile | string | yes | Mobile number (e.g. 9665...) |
string | yes | Valid e‑mail address |
Example Request
Success Response
Error Codes
100
: Missing parameters110
: Username already used111
: Mobile already used112
: Email already used120
: Username contains invalid characters121
: Password too short (<6)122
: Invalid username123
: Invalid password
3.2 generateToken(): array
Description: Obtain OAuth2 Bearer token.
HTTP Method | Endpoint |
---|---|
POST | /token/generate |
Parameters
Name | Type | Required | Description |
---|---|---|---|
grant_type | string | yes | Must be client_credentials |
client_id | string | yes | OAuth client ID |
client_secret | string | yes | OAuth client secret |
Example Request
Success Response
Error Responses
401 invalid_client
: Authentication failed400 unsupported_grant_type
: Wrong grant type
3.3 activate(string $user, string $code): array
Description: Activate a newly registered account.
HTTP Method | Endpoint |
---|---|
POST | /activate |
Parameters
Name | Type | Required | Description |
---|---|---|---|
user | string | yes | Username |
secret_key | string | yes | API secret key |
code | string | yes | Activation code |
Example Request
Response Codes
999
: Success100
: Missing parameters110
: Invalid username or secret_key111
: Wrong activation code
3.4 checkUser(): array
Description: Verify account credentials and activation status.
HTTP Method | Endpoint |
---|---|
POST | /chk_user |
Parameters
Name | Type | Required | Description |
---|---|---|---|
user | string | yes | Username |
secret_key | string | yes | API key |
Success Response
Error Codes
-100
: Missing parameters-110
: Account not exist or wrong credentials-111
: Account not activated-112
: Blocked account
3.5 balance(): array
Description: Retrieve SMS credit balance.
HTTP Method | Endpoint |
---|---|
POST | /chk_balance |
Parameters
Name | Type | Required | Description |
---|---|---|---|
user | string | yes | Username |
secret_key | string | yes | API key |
Success Response
Error Codes
-100
: Missing parameters-110
: Invalid credentials
3.6 addSender(string $sender): array
Description: Create a new sender name.
HTTP Method | Endpoint |
---|---|
POST | /newsender |
Parameters
Name | Type | Required | Description |
---|---|---|---|
user | string | yes | Username |
secret_key | string | yes | API key |
Error Codes
-113
: Duplicate sender-114
: Invalid sender name (chars or length)
3.7 senderStatus(string $sender): array
Description: Check activation status of a sender.
HTTP Method | Endpoint |
---|---|
POST | /senderstatus |
Parameters
Name | Type | Required | Description |
---|---|---|---|
user | string | yes | Username |
secret_key | string | yes | API key |
Status Values
Active
,UnActive
,Rejected
3.8 userSenders(): array
Description: List all senders for your account.
HTTP Method | Endpoint |
---|---|
POST | /usersender |
Success Response (XML)
3.9 sendSms(string $to, string $message, string $sender, array $options = []): array
Description: Send a single SMS, optionally with calendar reminder.
HTTP Method | Endpoint |
---|---|
POST | /sendsms |
Required Parameters
Name | Type | Description |
---|---|---|
user | string | Username |
secret_key | string | API key |
to | string | Recipient mobile number |
message | string | Message body |
Optional Calendar Fields (is_calander = 1
)
Name | Description |
---|---|
calander_date | YYYY-MM-DD |
calander_time | HH\:MM |
reminder | Minutes before event |
reminder_text | Reminder message |
location_url | Google Maps URL |
Example Usage
Response
SMS_ID:mobileNumber
on success- Negative codes for errors (
-113
insufficient balance,-119
invalid datetime, etc.)
3.10 sendMulti(array $toWithMsg, string $sender): array
Description: Send different messages to multiple recipients in one request.
HTTP Method | Endpoint |
---|---|
POST | /sendsms_multi |
Parameters
Name | Type | Description |
---|---|---|
user | string | Username |
secret_key | string | API key |
to | string | JSON: {"9665...":"Msg1","9665...":"Msg2"} |
Example Usage
Response
Same format as single sendSms
response.
4. Error Handling
Catch DreamSms\LaravelDreamSms\Exceptions\DreamSmsException
to manage HTTP or API errors:
6. Contributions
- Fork and clone
- Create a branch
feature/your-feature
- Write tests & code
- Submit a PR
Please follow PSR-12 and include tests for new methods.
7. License
MIT. See LICENSE.
All versions of laravel-dreamsms with dependencies
illuminate/support Version ^8.0|^9.0|^10.0|^11.0|^12.0