PHP code example of madewithlove / facebook-messenger-platform

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

    

madewithlove / facebook-messenger-platform example snippets


use Madewithlove\FacebookMessengerPlatform\Api\HttpClient;
use Madewithlove\FacebookMessengerPlatform\Api\Client;

$httpClient = new HttpClient('your_access_token');
$client = new Client($httpClient);

$client->send()->message('recipient_id', 'hello world');

$client->send()->image('recipient_id', 'http://url-to-image.com');

$client->send()->generic('recipient_id', []);

$client->send()->buttons('recipient_id', []);

$client->send()->buttons('recipient_id', []);