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

Commit

Permalink
add getLines() method
Browse files Browse the repository at this point in the history
add getLines method to help you fetch all of your sms lines
  • Loading branch information
TrueMoein committed Oct 28, 2017
1 parent 9f78812 commit 6c7b71b
Showing 1 changed file with 30 additions and 8 deletions.
38 changes: 30 additions & 8 deletions src/Smsir.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
class Smsir
{
/**
* This method used for log the messages to the database if db-log set to true.
* This method used for log the messages to the database if db-log set to true (@ smsir.php in config folder).
*
* @param $result
* @param $messages
Expand Down Expand Up @@ -45,7 +45,7 @@ public static function DBlog($result, $messages, $numbers) {
}

/**
* this method use in every request to get the token at first.
* this method used in every request to get the token at first.
*
* @return mixed - the Token for use api
*/
Expand All @@ -58,7 +58,7 @@ public static function getToken()
}

/**
* this method return your credit in sms.ir
* this method return your credit in sms.ir (sms credit, not money)
*
* @return mixed - credit
*/
Expand All @@ -69,14 +69,26 @@ public static function credit()
return json_decode($result->getBody(),true)['Credit'];
}

/**
* by this method you can fetch all of your sms lines.
*
* @return mixed , return all of your sms lines
*/
public static function getLines()
{
$client = new Client();
$result = $client->get('http://restfulsms.com/api/SMSLine',['headers'=>['x-sms-ir-secure-token'=>self::getToken()],'connect_timeout'=>30]);
return json_decode($result->getBody(),true);
}

/**
* Simple send message with sms.ir account and line number
*
* @param $messages = Messages - Count must be equal with $numbers
* @param $numbers = Numbers - must be equal with $messages
* @param null $sendDateTime = dont fill it if you want to send message now
*
* @return mixed
* @return mixed, return status
*/
public static function send($messages,$numbers,$sendDateTime = null)
{
Expand Down Expand Up @@ -120,6 +132,8 @@ public static function addToCustomerClub($prefix,$firstName,$lastName,$mobile,$b
}

/**
* this method send message to your customer club contacts (known as white sms module)
*
* @param $messages
* @param $numbers
* @param null $sendDateTime
Expand All @@ -146,6 +160,8 @@ public static function sendToCustomerClub($messages,$numbers,$sendDateTime = nul
}

/**
* this method add contact to the your customer club and then send a message to him/her
*
* @param $prefix
* @param $firstName
* @param $lastName
Expand All @@ -168,6 +184,8 @@ public static function addContactAndSend($prefix,$firstName,$lastName,$mobile,$m
}

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

/**
* this method used for fetch received messages
*
* @param $perPage
* @param $pageNumber
* @param $formDate
Expand All @@ -203,10 +223,12 @@ public static function getReceivedMessages($perPage,$pageNumber,$formDate,$toDat
}

/**
* @param $perPage
* @param $pageNumber
* @param $formDate
* @param $toDate
* this method used for fetch your sent messages
*
* @param $perPage = how many sms you want to fetch in every page
* @param $pageNumber = the page number
* @param $formDate = from date
* @param $toDate = to date
*
* @return mixed
*/
Expand Down

0 comments on commit 6c7b71b

Please sign in to comment.