PHPackages                             ejlin/line-login-sdk-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. ejlin/line-login-sdk-php

ActiveLibrary[API Development](/categories/api)

ejlin/line-login-sdk-php
========================

SDK of the LINE Login API for PHP

0.1.2(4y ago)43823MITPHPPHP ^7.2||^8.0

Since Nov 3Pushed 4y ago1 watchersCompare

[ Source](https://github.com/TyperEJ/line-login-sdk-php)[ Packagist](https://packagist.org/packages/ejlin/line-login-sdk-php)[ RSS](/packages/ejlin-line-login-sdk-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (3)Versions (3)Used By (0)

LINE Login for PHP
==================

[](#line-login-for-php)

SDK of the LINE Login API for PHP

Documentation
-------------

[](#documentation)

See the [official API documentation](https://developers.line.biz/en/docs/line-login/) for more information.

Installation
------------

[](#installation)

Use the package manager [composer](https://getcomposer.org) to install package.

```
composer require ejlin/line-login-sdk-php
```

Usage
-----

[](#usage)

\###Pure PHP version:

```
$httpClient = new \EJLin\LINELogin\GuzzleHTTPClient();

// Channel Basic Information: https://developers.line.biz/console/channel//basics
$LINELogin = new \EJLin\LINELogin($httpClient, ['clientId' => '','clientSecret' => '']);

// Step 3. After login, the LINE will redirect to the URL that you requested with state and code
if(isset($_GET['code']) && isset($_GET['state']))
{
    // TODO: Check the state code same as what you requested

    // Request access token from the LINE platform
    $token = $LINELogin->requestToken(
        'https://yourdomain.com', // The url must be the same as requested
        $_GET['code'] // Each code only can request a token once
    );

    // Get user profile from the LINE platform
    $userProfile = $LINELogin->getUserProfile($token);

    printf("Hello %s !",$userProfile->getDisplayName());

    exit;
}

// A unique alphanumeric string used to prevent cross-site request forgery
$state = \EJLin\LINELogin\Helper::randomString(40);

// Step 1. Make authorize url
$authorizeUrl = $LINELogin->makeAuthorizeUrl(
    'https://yourdomain.com', // Callback URL: https://developers.line.biz/console/channel//line-login
    'profile openid email', // Permissions requested from the user: https://developers.line.biz/en/docs/line-login/integrate-line-login/#scopes
    $state
);

// Step 2. Redirect to authorize url
header("Location: $authorizeUrl");
exit;
```

\###Laravel support:

After installed, add `LINE_LOGIN_CHANNEL_ID` and `LINE_LOGIN_CHANNEL_SECRET` to .env

```
LINE_LOGIN_CHANNEL_ID=
LINE_LOGIN_CHANNEL_SECRET=

```

then you can use `LINELogin` and `LINELoginHelper` facades like following.

```
// Step 3.
if(request()->has('code') && request()->has('state'))
{
    $token = \EJLin\Laravel\Facades\LINELogin::requestToken(
            url()->current(),
            request()->input('code'),
        );

    $userProfile = \EJLin\Laravel\Facades\LINELogin::getUserProfile($token);

    return "Hello {$userProfile->getDisplayName()} !";
}

$state = \EJLin\Laravel\Facades\LINELoginHelper::randomString(40);

// Step 1.
$authorizeUrl = \EJLin\Laravel\Facades\LINELogin::makeAuthorizeUrl(
    url()->current(),
    'profile openid email',
    $state
);

// Step 2.
return redirect()->away($authorizeUrl);
```

Reference
---------

[](#reference)

- [kkdai / line-login-sdk-go](https://github.com/kkdai/line-login-sdk-go)
- [line / line-bot-sdk-php](https://github.com/line/line-bot-sdk-php)
- [laravel / laravel](https://github.com/laravel/laravel)

Contributing
------------

[](#contributing)

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License
-------

[](#license)

[MIT](https://choosealicense.com/licenses/mit/)

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~116 days

Total

2

Last Release

1539d ago

PHP version history (2 changes)0.1.1PHP ^7.0

0.1.2PHP ^7.2||^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/2a743d6ff8b3b9b8cd1950d6bbd933249ad12618abc6f74fb8277d451718b2ad?d=identicon)[EJLin](/maintainers/EJLin)

---

Top Contributors

[![TyperEJ](https://avatars.githubusercontent.com/u/42922266?v=4)](https://github.com/TyperEJ "TyperEJ (12 commits)")

---

Tags

laravelline-loginlineloginphpphp-lineloginsdk

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ejlin-line-login-sdk-php/health.svg)

```
[![Health](https://phpackages.com/badges/ejlin-line-login-sdk-php/health.svg)](https://phpackages.com/packages/ejlin-line-login-sdk-php)
```

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[convertkit/convertkitapi

Kit PHP SDK for the Kit API

2167.1k1](/packages/convertkit-convertkitapi)[mapado/rest-client-sdk

Rest Client SDK for hydra API

1125.9k2](/packages/mapado-rest-client-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
