Skip to content
This repository was archived by the owner on Oct 22, 2020. It is now read-only.

Commit 6c7b71b

Browse files
committed
add getLines() method
add getLines method to help you fetch all of your sms lines
1 parent 9f78812 commit 6c7b71b

File tree

1 file changed

+30
-8
lines changed

1 file changed

+30
-8
lines changed

src/Smsir.php

+30-8
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
class Smsir
77
{
88
/**
9-
* This method used for log the messages to the database if db-log set to true.
9+
* This method used for log the messages to the database if db-log set to true (@ smsir.php in config folder).
1010
*
1111
* @param $result
1212
* @param $messages
@@ -45,7 +45,7 @@ public static function DBlog($result, $messages, $numbers) {
4545
}
4646

4747
/**
48-
* this method use in every request to get the token at first.
48+
* this method used in every request to get the token at first.
4949
*
5050
* @return mixed - the Token for use api
5151
*/
@@ -58,7 +58,7 @@ public static function getToken()
5858
}
5959

6060
/**
61-
* this method return your credit in sms.ir
61+
* this method return your credit in sms.ir (sms credit, not money)
6262
*
6363
* @return mixed - credit
6464
*/
@@ -69,14 +69,26 @@ public static function credit()
6969
return json_decode($result->getBody(),true)['Credit'];
7070
}
7171

72+
/**
73+
* by this method you can fetch all of your sms lines.
74+
*
75+
* @return mixed , return all of your sms lines
76+
*/
77+
public static function getLines()
78+
{
79+
$client = new Client();
80+
$result = $client->get('http://restfulsms.com/api/SMSLine',['headers'=>['x-sms-ir-secure-token'=>self::getToken()],'connect_timeout'=>30]);
81+
return json_decode($result->getBody(),true);
82+
}
83+
7284
/**
7385
* Simple send message with sms.ir account and line number
7486
*
7587
* @param $messages = Messages - Count must be equal with $numbers
7688
* @param $numbers = Numbers - must be equal with $messages
7789
* @param null $sendDateTime = dont fill it if you want to send message now
7890
*
79-
* @return mixed
91+
* @return mixed, return status
8092
*/
8193
public static function send($messages,$numbers,$sendDateTime = null)
8294
{
@@ -120,6 +132,8 @@ public static function addToCustomerClub($prefix,$firstName,$lastName,$mobile,$b
120132
}
121133

122134
/**
135+
* this method send message to your customer club contacts (known as white sms module)
136+
*
123137
* @param $messages
124138
* @param $numbers
125139
* @param null $sendDateTime
@@ -146,6 +160,8 @@ public static function sendToCustomerClub($messages,$numbers,$sendDateTime = nul
146160
}
147161

148162
/**
163+
* this method add contact to the your customer club and then send a message to him/her
164+
*
149165
* @param $prefix
150166
* @param $firstName
151167
* @param $lastName
@@ -168,6 +184,8 @@ public static function addContactAndSend($prefix,$firstName,$lastName,$mobile,$m
168184
}
169185

170186
/**
187+
* this method send a verification code to your customer. need active the module at panel first.
188+
*
171189
* @param $code
172190
* @param $number
173191
*
@@ -187,6 +205,8 @@ public static function sendVerification($code,$number,$log = false)
187205
}
188206

189207
/**
208+
* this method used for fetch received messages
209+
*
190210
* @param $perPage
191211
* @param $pageNumber
192212
* @param $formDate
@@ -203,10 +223,12 @@ public static function getReceivedMessages($perPage,$pageNumber,$formDate,$toDat
203223
}
204224

205225
/**
206-
* @param $perPage
207-
* @param $pageNumber
208-
* @param $formDate
209-
* @param $toDate
226+
* this method used for fetch your sent messages
227+
*
228+
* @param $perPage = how many sms you want to fetch in every page
229+
* @param $pageNumber = the page number
230+
* @param $formDate = from date
231+
* @param $toDate = to date
210232
*
211233
* @return mixed
212234
*/

0 commit comments

Comments
 (0)