PHP code example of mesak / laravel-linebot

1. Go to this page and download the library: Download mesak/laravel-linebot library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mesak / laravel-linebot example snippets


    'listener' => 'App\Listeners\LineBotListener',

use Illuminate\Http\Request;

Route::post('/line', function (Request $request) {
    return \Facades\Mesak\LineBot\Contracts\Bot::handle($request);
});


    $this->app->singleton(\Mesak\LineBot\Contracts\Bot::class, function ($app) {
        return tap(new \App\Services\EntityBot(config('linebot') , $app['events']) ,function($bot){
            $bot->boot();
        });
    });




namespace App\Services\LineBot;

use Mesak\LineBot\EntityBot as BaseEntityBot;
use Mesak\LineBot\Contracts\Bot as BotContract;

class EntityBot extends BaseEntityBot implements BotContract
{
  //do something...
}

bash
php artisan vendor:publish --tag=mesak-linebot.config --force
bash
php artisan vendor:publish --tag=mesak-linebot.listener