https://github.com/chez14/line-sdk-php
Line SDK Client for PHP. Used for simple Login API or Social API.
https://github.com/chez14/line-sdk-php
line line-api php
Last synced: about 7 hours ago
JSON representation
Line SDK Client for PHP. Used for simple Login API or Social API.
- Host: GitHub
- URL: https://github.com/chez14/line-sdk-php
- Owner: chez14
- License: mit
- Created: 2019-04-07T13:39:50.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-10-15T02:01:22.000Z (over 6 years ago)
- Last Synced: 2026-03-01T18:51:51.350Z (3 months ago)
- Topics: line, line-api, php
- Language: PHP
- Size: 55.7 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# line-sdk-php
[](https://github.com/chez14/line-sdk-php)
[](https://github.com/chez14/line-sdk-php) [](https://packagist.org/packages/chez14/line-sdk) [](https://github.com/chez14/line-sdk-php)
Line SDK Client for PHP. Used for simple Login API or Social API.
**STILL UNSTABLE, I'M STILL TESTING THESE APIs**. Do at your own risk.
# About the LINE API
See the official API documentation for more information.
English: [developers.line.me/en/docs](https://developers.line.me/en/docs)
Japanese: [developers.line.me/ja/docs](https://developers.line.me/ja/docs)
# Getting Started
## Installation
Use [Composer](https://getcomposer.org) to pull this library.
```shell
$ composer require chez14/line-sdk
```
## Create a Channel
1. Create a LINE Channel, follow [this step](https://developers.line.biz/en/docs/line-login/getting-started/) to get started. Or simply use the one you have.
2. Go to [LINE Developer Console](https://developers.line.biz/console/), grab the Channel Secret and Channel ID.
## Creating API Instance
Create a new object from `LINE\Api`. Don't forget to supply both `client_id` and `client_secret` to the parameter.
```php
$api = new LINE\Api([
"channel_secret" => '00112233445566778899aabbccddeeff',
"channel_id" => '0123456789'
]);
```
After that, you can use your get your auth code, and do some OAuth job.
```php
$login = new LINE\Login($api);
echo $login->get_authorization_url("http://localhost/callback.php", [
LINE\Login::SCOPE_OPENID,
LINE\Login::SCOPE_PROFILE
]) . PHP_EOL;
// will produce:
// https://access.line.me/oauth2/v2.1/authorize?response_type=code&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Fakun%2Foauth%2Fline&client_id=0123456789&scope=openid+profile&state=1OaoBjV9US69fzOx&prompt=consent
// OR
echo $login->get_authorization_url("http://localhost/callback.php", [
"openid","profile"
]) . PHP_EOL;
// -------------- on the callback.php:
$token = $login->parse_from_request();
$api->setToken($token);
$social = new LINE\Social($api);
var_dump($social->getProfile()); //echo the profiles
```
Check our documentation page to get more info about this library classes, and
see our [`examples` folder](examples/) to get more examples.
## Go beyond, and plus ultra!
Check this API Documentation (tbd), and check LINE's corresponding documentations.
Have fun!

# License
[MIT](LICENSE).
# Bug Report
Please, if you have any feedback or bug report for this lib, submit it to
the issue tracker. If you concern about the security and privacy, you can
PGP-encrypt it using [Chez14's Keybase](https://keybase.io/encrypt#chez14),
and submit it as an issue.