PHPackages                             syllistudio/line-messaging - 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. syllistudio/line-messaging

ActiveLibrary[API Development](/categories/api)

syllistudio/line-messaging
==========================

Foundation Line Messaging SDK

0.0.2(8y ago)0151PHPPHP &gt;=5.4

Since Nov 30Pushed 8y ago1 watchersCompare

[ Source](https://github.com/syllistudio/line-messaging)[ Packagist](https://packagist.org/packages/syllistudio/line-messaging)[ RSS](/packages/syllistudio-line-messaging/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (3)Used By (0)

Line Messaging For PHP
======================

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

About Line Messaging
--------------------

[](#about-line-messaging)

This package provides easy integration with LINE Message API interfaces. The package contains 2 essential parts. First, a webhook that handles events sent from LINE Messaging API. Second, simple methods to communicate using Line Messaging API.

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

[](#installation)

This package can be installed through Composer.

```
$ composer require syllistudio/line-messaging

```

The service provider will automatically register itself. After that, You need to add our `Syllistudio\LineMessaging\LineMessagingProvider::class` to the array of Service Providers in file `config/app.php` You must publish the config file with:

```
php artisan vendor:publish --provider="Syllistudio\LineMessaging\LineMessagingProvider" --tag="config"

```

This is the contents of the config file that will be published at `config/line-messaging.php`:

```
return [
	/*
     * You need to define your channel secret and access token in your environment variables
     */
    'channel_secret' => env('LINEBOT_CHANNEL_SECRET'),
    'channel_access_token' => env('LINEBOT_CHANNEL_ACCESS_TOKEN'),
];
```

You can customize your `channel_secret` and `channel_access_token` here or define it in your environment variables.

Note: Find both `channel_secret` and `channel_access_token` in your console LINE channel.

Usage
-----

[](#usage)

Mechanism to work with LINE bot is a communication between the server of your bot application and the LINE Platform. When a user sends your bot a message, LINE Messaging API will send a request to your webhook URL. The webhook created with this package will provide methods to handle those events sent from LINE Messaging API. To response to those events or communicate with your contacts, this package provide methods that let the server sends a request to the LINE Platform to respond to the user. Requests are sent over HTTPS in JSON format.

### Create Webhook URL

[](#create-webhook-url)

You can create it easily in your routing. You will first need to create Controller and use our trait `LineWekhookReceiver`. After that, in the route file of your app, you must create a route to the created Controller `Route::post('/webhook', 'YourControllerName@handleWebhook')`. This will give you the webhook URL and you will need to set this webhook URL in your LINE console to integrate your app with LINE messaging API.

```
