PHP code example of danielzhao1990 / easy_feishu

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

    

danielzhao1990 / easy_feishu example snippets




use EasyFeishu\FeiShuApp;

$config = [
    'debug' => false,
    'app_id' => '',
    'app_secret' => '',
    'encrypt_key' => '',
    'verification_token' => '',
    'log' => [
        'file' => __DIR__ . '/../logs/' . date('Y-m-d') . '.log',
        'level' => 'debug',
    ],
];

$app = new FeiShuApp($config);
$card = $this->getFeishuApp()->messageBuilder->buildCardMessage();
$card->setHeader("紧急消息")
    ->addElementText("您有2条任务即将过期 \n 完成测试1 \n 完成测试2")
    ->addActionButton("查看任务", "http://xxxx")
    ->addActionButton("忽略");
$sendRes = $this->getFeishuApp()->message->send("open_id", $user['open_id'], $card);