Mattermost PHP SDK
A PHP SDK for building apps and integrations for Mattermost.
Features
- API Client - Fluent, type-safe wrapper around the Mattermost REST API with 40+ endpoint groups
- Slash Commands - Framework for implementing custom slash commands
Quick Links
- Getting Started - Installation and first steps
- API Client - Using the REST API client
- Slash Commands - Custom slash command development
- Examples - Code examples for common use cases
Requirements
- PHP 8.2 or higher
- Composer
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!'));
Links
License
MIT