wilkques / line-notify
line-notify
v1.0.0
2022-03-10 04:07 UTC
Requires
- php: >=7.0
- ext-curl: *
- ext-json: *
- wilkques/http-client: ^1.0.0
README
composer require wilkques/line-notify
How to use
-
Generate URL
use Wilkques\LineNotify\Notify; $notify = new Notify('<CHANNEL_ID>'); $url = $notify->generateSubscribeUrl($options); // or $url = Notify::clientId('<CHANNEL_ID>')->generateSubscribeUrl($options);
-
GET Access Token
use Wilkques\LineNotify\Notify; $notify = new Notify('<CHANNEL_ID>', '<CHANNEL_SECRET>'); $token = $notify->requestToken($_GET['code'])->accessToken(); // or $token = Notify::clientId('<CHANNEL_ID>') ->clientSecret('<CHANNEL_SECRET>') ->requestToken($_GET['code']) ->throw() // throw exception ->accessToken();
-
Push Message
use Wilkques\LineNotify\Notify; use Wilkques\LineNotify\Message; // Builder Message $message = new Message('<Notify Text>'); // or $message = Message::message('<Notify Text>'); // Get Response $response = (new Notify)->token('<Access Token>')->sendMessage($message); // or $response = Notify::token('<Access Token>')->sendMessage($message); $response->throw(); // throw exceptions // or $response->throw(function (\Wilkques\Http\Response $response, \Wilkques\Http\Exceptions\RequestException $exception) { // code // return exceptions });
-
Methods
- Response see REFERENCE Http Client