PHP code example of wxiangqian / laravel-dingtalk

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

    

wxiangqian / laravel-dingtalk example snippets


   php artisan vendor:publish 

   则生成 config/dingtalk.php

$DingTalk = new DingTalk();
$message = new Message();
$data = $message->text('测试text类型');
$res = $DingTalk->send($token,$data);
echo $res;

$DingTalk = new DingTalk();
$message = new Message();
$title = '测试link类型title';
$text = '测试link类型text';
$messageUrl = 'https://www.baidu.com/';
$picUrl = '';
$data = $message->link($title, $text, $messageUrl, $picUrl);
$res = $DingTalk->send($token,$data);
echo $res;

$DingTalk = new DingTalk();
$message = new Message();
$title = '北京天气MD';
$text = '# laravel-DingTalk是基于laravel5.5开发的钉钉机器人';
$data = $message->markdown($title, $text);
$res = $DingTalk->send($token,$data);
echo $res;