Skip to content

Commit

Permalink
Issue #2 method description
Browse files Browse the repository at this point in the history
  • Loading branch information
kittinan committed Oct 14, 2017
1 parent 7bba81e commit ffc1852
Showing 1 changed file with 36 additions and 4 deletions.
40 changes: 36 additions & 4 deletions src/LineNotify.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,59 @@

use GuzzleHttp\Client;

/**
* A simple class to send text message, image and Line sticker on Line notify
*
* https://notify-bot.line.me/doc/en/
*
* @property string $token Line notify token
* @property \GuzzleHttp\Client $http Guzzle Http Client instance for send Http request
*/
class LineNotify {

const API_URL = 'https://notify-api.line.me/api/notify';

private $token = null;
private $http = null;


/**
* Initialize class with Line notify token string
*
* @param string $token the token of Line notify
*/
public function __construct($token) {

$this->token = $token;
$this->http = new Client();
}


/**
* Set token Line notify that want to send message
*
* @param string $token the token of Line notify
*/
public function setToken($token) {
$this->token = $token;
}


/**
* Get current token Line Notify
*
* @return string the token of Line notify
*/
public function getToken() {
return $this->token;
}


/**
* Send text message, image or sticker on Line notify
*
* @param string $text text message on Line notify can not be empty
* @param string $imagePath image path you want to send on the local machine
* @param array() $sticker array of line sticker ['stickerPackageId' => PACKAGE_ID, 'stickerId' => STICKER_ID ]
* more info https://devdocs.line.me/files/sticker_list.pdf
* @return boolean success or fail on send Line notify message
*/
public function send($text, $imagePath = null, $sticker = null) {

if (empty($text)) {
Expand Down

0 comments on commit ffc1852

Please sign in to comment.