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)43863MITPHPPHP ^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 today

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 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

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

1587d ago

PHP version history (2 changes)0.1.1PHP ^7.0

0.1.2PHP ^7.2||^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/10904762?v=4)[Eric Lin](/maintainers/EJLin)[@ejlin](https://github.com/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

[statamic/cms

The Statamic CMS Core Package

4.8k3.6M985](/packages/statamic-cms)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3741.3M47](/packages/tencentcloud-tencentcloud-sdk-php)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k656.1k38](/packages/neuron-core-neuron-ai)[avalara/avataxclient

Client library for Avalara's AvaTax suite of business tax calculation and processing services. Uses the REST v2 API.

528.5M7](/packages/avalara-avataxclient)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

273.0k](/packages/eslazarev-wildberries-sdk)[files.com/files-php-sdk

Files.com PHP SDK

2481.1k](/packages/filescom-files-php-sdk)

PHPackages © 2026

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