Skip to the content.

Mattermost PHP SDK

A PHP SDK for building apps and integrations for Mattermost.

Features

Requirements

Installation

composer require cedricziel/mattermost-php

Quick Example

<?php

use CedricZiel\MattermostPhp\Client;
use CedricZiel\MattermostPhp\Client\Model\CreatePostRequest;

$client = new Client('https://your-mattermost-instance.com');
$client->setToken('your-access-token');

// Get a channel and post a message
$team = $client->teams()->getTeamByName('my-team');
$channel = $client->channels()->getChannelByName($team->id, 'town-square');
$post = $client->posts()->createPost(new CreatePostRequest($channel->id, 'Hello from PHP!'));

License

MIT