PHP code example of bootdesk / chat-sdk-adapter-github

1. Go to this page and download the library: Download bootdesk/chat-sdk-adapter-github 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/ */

    

bootdesk / chat-sdk-adapter-github example snippets


$adapter = new GitHubAdapter(
    httpClient: new \GuzzleHttp\Client,
    webhookSecret: env('GITHUB_WEBHOOK_SECRET'),
    authToken: env('GITHUB_AUTH_TOKEN'),
);

$adapter = new GitHubAdapter(
    httpClient: new \GuzzleHttp\Client,
    webhookSecret: env('GITHUB_WEBHOOK_SECRET'),
    authToken: env('GITHUB_AUTH_TOKEN'), // optional fallback
    appId: env('GITHUB_APP_ID'),
    installationId: env('GITHUB_INSTALLATION_ID'),
    privateKey: env('GITHUB_PRIVATE_KEY'),
);

$adapter = new GitHubAdapter(
    httpClient: new \GuzzleHttp\Client,
    webhookSecret: env('GITHUB_WEBHOOK_SECRET'),
    authToken: env('GITHUB_AUTH_TOKEN'), // optional fallback
    appId: env('GITHUB_APP_ID'),
    privateKey: env('GITHUB_PRIVATE_KEY'),
);

'github' => [
    'auth_token'     => env('GITHUB_AUTH_TOKEN'),
    'webhook_secret' => env('GITHUB_WEBHOOK_SECRET'),
],

// Post a comment on a pull request
$adapter->postMessage('github:owner/repo:42', 'LGTM!');

// Post a comment on an issue
$adapter->postMessage('github:owner/repo:issue:15', 'Thanks for reporting.');

// Reply to a review comment thread
$adapter->postMessage('github:owner/repo:42:rc:9876543', 'Fixed in abc123.');