slim-messenger / controller
Controller for routing Facebook's Messenger Bot API
0.0.0
2016-06-02 16:15 UTC
Requires
- php: >=5.6.0
- evenement/evenement: ^2.0
Requires (Dev)
- phpunit/phpunit: 5.3.*
- slim/http: ^0.1.0
This package is not auto-updated.
Last update: 2024-10-26 19:11:37 UTC
README
Easily set up your SlimPHP Routes to integrate with Facebook's Messenger Bot API. Slim Messenger Controller intended to be a RESTful Controller to be used by SlimPHP routes, and easily set up to be injected at SlimPHP Container. While this is created for SlimPHP, Slim Messenger Controller can be used as controller at any framework that implement PSR7 interfaces for its Request and Response objects
Installation
composer install slim-messenger/controller
Usage
$appToken = 'YOUR_APP_TOKEN'; $verifyToken = 'YOUR_VERIFY_TOKEN'; // initiate controller $messengerController = new SlimMessenger\Controller($verifyToken, $appToken); //slim routes $app->any('/webhook[/]', $messengerController);
You can also inject it to SlimPHP Container
$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']);
Documentation
see DOCUMENTATION