PHP code example of slim-messenger / controller

1. Go to this page and download the library: Download slim-messenger/controller 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/ */

    

slim-messenger / controller example snippets


$appToken = 'YOUR_APP_TOKEN';
$verifyToken = 'YOUR_VERIFY_TOKEN';

// initiate controller
$messengerController = new SlimMessenger\Controller($verifyToken, $appToken);

//slim routes
$app->any('/webhook[/]', $messengerController);

$container = $app->getContainer();

$container['bot'] = function($c) {
    $appToken = 'YOUR_APP_TOKEN';
    $verifyToken = 'YOUR_VERIFY_TOKEN';

    $messangerBot = new SlimMessengerController($verifyToken, $appToken);

    return $messangerBot;
};

//slim routes
$app->any('/webhook[/]', $container['bot']);