Download the PHP package yidas/line-notify-sdk without Composer
On this page you can find all versions of the php package yidas/line-notify-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download yidas/line-notify-sdk
More information about yidas/line-notify-sdk
Files in yidas/line-notify-sdk
Package line-notify-sdk
Short Description LINE Notify SDK for PHP
License MIT
Homepage https://github.com/yidas/line-notify-sdk-php
Informations about the package line-notify-sdk
LINE Notify SDK for PHP
LINE Notify SDK for PHP
OUTLINE
- Demonstration
- Requirements
- Client for LINE Notify
- Installation
- Usage
- Auth Client
- getAuthUrl()
- getAccessToken()
- getCode()
- getWebPath()
- Notify Client
- notify()
- status()
- revoke()
- setAccessTokens()
- addAccessToken()
- getRateLimit()
- Shared Methods
- getResponseLogs()
- Auth Client
- Resources
DEMONSTRATION
Sample Codes Site for LINE Notify
As a quick start, use Auth
client to create an authorize URL with callback redirectUrl for redirection:
Next, use Auth
client to get accessToken on callback URL (redirectUrl.php
), then use Notify
client to send notifications with accessToken:
REQUIREMENTS
This library requires the following:
- PHP >= 5.4.0
- guzzlehttp/guzzle >= 5.3.1
- LINE Notify service client
Client for LINE Notify
Each LINE Notify service require authentication information for integration, as shown below:
- Client ID
- Client Secret
To get a LINE Notify Client:
- Register a new LINE Notify service from LINE Notify - Add service with redirectUrl setting.
- After registering, get your service's clientId/clientSecret from LINE Notify - Manage registered services (service provider) for integration.
INSTALLATION
Run Composer in your project:
composer require yidas/line-notify-sdk ~1.0.0
Then you could use SDK class after Composer is loaded on your PHP project:
USAGE
Before using any API methods, first you need to create a Client with configuration, then use the client to access LINE Notify API methods.
Auth Client
Create a LINE Notify Auth Client with API Authentication:
Parameters
array $config
:
Key | Required | Type | Default | Description |
---|---|---|---|---|
clientId | Y | string | LINE Notify service's client ID | |
clientSecret | Y | string | LINE Notify service's client Secret | |
debug | N | boolean | false | Debug mode: Throw error exception when API request or result fails |
log | N | boolean | false | Log mode: Save all responses to each API request |
getAuthUrl()
Get LINE Notify OAuth authorize URL
Example:
getAccessToken()
Get AccessToken with redirectUrl and callback's code
Example:
getCode()
Get code on callback redirect URL
getWebPath()
Get current web URL path
Notify Client
Create a LINE Notify Client with accessToekn setting:
Parameters
string|array $accessTokens
: Support single or multiple accessTokens for notificationarray $config
:
Key | Required | Type | Default | Description |
---|---|---|---|---|
debug | N | boolean | false | Debug mode: Throw error exception when API request or result fails |
log | N | boolean | false | Log mode: Save all responses to each API request |
notify()
Send notification concurrently based on accessToken(s)
Return Values: Number of successful notifications
Example:
Options
Option | Type | Description |
---|---|---|
message | string | 1000 characters max |
imageThumbnail | HTTP/HTTPS URL | Maximum size of 240×240px JPEG |
imageFullsize | HTTP/HTTPS URL | Maximum size of 2048×2048px JPEG |
imageFile | string | Local file path |
stickerPackageId | number | Package ID. (Sticker List) |
stickerId | number | Sticker ID. |
notificationDisabled | boolean | Deault is false |
Example
imageFile
requires to be a file path of string type
status()
Check accessToken connection status
Example:
revoke()
Revoke accessToken on the connected service side
Example:
setAccessTokens()
Set AccessTokens for sending notification
addAccessToken()
Add an AccessToken for sending notification
getRateLimit()
Get last response's Rate Limit information
Shared Methods
getResponseLogs()
Get response logs when log mode is enabled