定制 thibaud-dauce/mattermost-php 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

thibaud-dauce/mattermost-php

最新稳定版本:1.3.0

Composer 安装命令:

composer require thibaud-dauce/mattermost-php

包简介

Mattermost PHP driver to send incoming webhooks

README 文档

README

This driver for Mattermost allows you to send message for incoming webhooks.

Installation

Install project with composer

  composer require thibaud-dauce/mattermost-php

Usage/Examples

This is a full example from tests/test.php:

<?php

require __DIR__ . '/../vendor/autoload.php';

use GuzzleHttp\Client;
use ThibaudDauce\Mattermost\Mattermost;
use ThibaudDauce\Mattermost\Message;
use ThibaudDauce\Mattermost\Attachment;

$mattermost = new Mattermost(new Client);

$message = (new Message)
    ->text('This is a *test*.')
    ->channel('tests')
    ->username('A Tester')
    ->iconUrl('https://upload.wikimedia.org/wikipedia/fr/f/f6/Phpunit-logo.gif')
    ->attachment(function (Attachment $attachment) {
        $attachment->fallback('This is the fallback test for the attachment.')
            ->success()
            ->pretext('This is optional pretext that shows above the attachment.')
            ->text('This is the text. **Finaly!**')
            ->authorName('Mattermost')
            ->authorIcon('http://www.mattermost.org/wp-content/uploads/2016/04/icon_WS.png')
            ->authorLink('http://www.mattermost.org/')
            ->title('Example attachment', 'http://docs.mattermost.com/developer/message-attachments.html')
            ->field('Long field', 'Testing with a very long piece of text that will take up the whole width of the table. And then some more text to make it extra long.', false)
            ->field('Column one', 'Testing.', true)
            ->field('Column two', 'Testing.', true)
            ->field('Column one again', 'Testing.', true)
            ->imageUrl('http://www.mattermost.org/wp-content/uploads/2016/03/logoHorizontal_WS.png')
            ->action([
                'name' => 'Some button text',
                'integration' => [
                    'url' => 'https://my-post-api.example.org',
                    'context' => [
                        'user_id' => '123',
                        'secret_key' => 'bépo22',
                    ],
                ]
            ]);
    });

$mattermost->send($message, 'https://your_mattermost_webhook_url');

You can play with it by running php tests/test.php after setting your incoming webhook URL for your server.

统计信息

  • 总下载量: 413.66k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 27
  • 点击次数: 2
  • 依赖项目数: 13
  • 推荐数: 0

GitHub 信息

  • Stars: 27
  • Watchers: 6
  • Forks: 13
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固