PHPackages                             scaleplan/php-mattermost-driver - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. scaleplan/php-mattermost-driver

ActiveLibrary[API Development](/categories/api)

scaleplan/php-mattermost-driver
===============================

The Php Driver to interact with the Mattermost Web Service API

v2.9.0(6y ago)023MITPHPPHP &gt;=5.5.0

Since Apr 19Pushed 6y agoCompare

[ Source](https://github.com/scaleplan/php-mattermost-driver)[ Packagist](https://packagist.org/packages/scaleplan/php-mattermost-driver)[ Docs](https://github.com/gnello/php-mattermost-driver)[ RSS](/packages/scaleplan-php-mattermost-driver/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (4)Versions (21)Used By (0)

php-mattermost-driver (v4)
==========================

[](#php-mattermost-driver-v4)

[![Latest Stable Version](https://camo.githubusercontent.com/a51a9114bc6dd8685ebb2dd1deb28ebaaa325233d250d2dd12dc424032af9ca9/68747470733a2f2f706f7365722e707567782e6f72672f676e656c6c6f2f7068702d6d61747465726d6f73742d6472697665722f762f737461626c65)](https://packagist.org/packages/gnello/php-mattermost-driver) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/093a516c2fb9d6fa475da8206c42c78223d4bef01962a8f060cfe1b1b933a5b2/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f676e656c6c6f2f7068702d6d61747465726d6f73742d6472697665722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/gnello/php-mattermost-driver/?branch=master) [![Total Downloads](https://camo.githubusercontent.com/e56d41645a67d36ec84937dc715ac6c01e30a545962a3af0a8448b74ebcb534e/68747470733a2f2f706f7365722e707567782e6f72672f676e656c6c6f2f7068702d6d61747465726d6f73742d6472697665722f646f776e6c6f616473)](https://packagist.org/packages/gnello/php-mattermost-driver)

The Php Driver to interact with the [Mattermost Web Service API](https://about.mattermost.com/).

Please read [the api documentation](https://api.mattermost.com/) for further information on using this application.

Installation
------------

[](#installation)

### Composer

[](#composer)

The best way to install php-mattermost-driver is to use Composer:

```
composer require gnello/php-mattermost-driver

```

Read more about how to install and use Composer on your local machine [here](https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx).

### Laravel

[](#laravel)

If you are going to install this library on laravel maybe you prefer to install the [laravel-mattermost-driver](https://github.com/gnello/laravel-mattermost-driver).

#### V3

[](#v3)

If you want to install the [V3 Driver](https://github.com/gnello/php-mattermost-driver/tree/v1.3.0) instead of the V4 one you should do:

```
composer require gnello/php-mattermost-driver:1.*

```

Usage
-----

[](#usage)

### Authentication

[](#authentication)

#### Login id and password

[](#login-id-and-password)

```
 use \Scaleplan\Mattermost\Driver;

 $container = new \Pimple\Container([
     'driver' => [
         'url' => 'your_chat_url',
         'login_id' => 'your_login_id',
         'password' => 'your_password',
     ],
     'guzzle' => [
         //put here any options for Guzzle
     ]
 ]);

 $driver = new Driver($container);
 $result = $driver->authenticate();
```

#### Token

[](#token)

```
 use \Scaleplan\Mattermost\Driver;

 $container = new \Pimple\Container([
     'driver' => [
         'url' => 'your_chat_url',
         'token' => 'your_token',
     ],
     'guzzle' => [
         //put here any options for Guzzle
     ]
 ]);

 $driver = new Driver($container);
 $result = $driver->authenticate();
```

### Check results

[](#check-results)

This Driver follows the [PSR-7](http://www.php-fig.org/psr/psr-7/) document therefore any response is a ResponseInterface type:

```
if ($result->getStatusCode() == 200) {
    echo "Everything is ok.";
    var_dump(json_decode($result->getBody()));
} else {
    echo "HTTP ERROR " . $result->getStatusCode();
}
```

### Users endpoint

[](#users-endpoint)

```
//Add a new user
$result = $driver->getUserModel()->createUser([
    'email'    => 'test@test.com',
    'username' => 'test',
    'password' => 'testpsw'
]);

//Get a user
$result = $driver->getUserModel()->getUserByUsername('username');

//Please read the UserModel class or refer to the api documentation for a complete list of available methods.
```

### Channels endpoint

[](#channels-endpoint)

```
//Create a channel
$result = $driver->getChannelModel()->createChannel([
    'name'         => 'new_channel',
    'display_name' => 'New Channel',
    'type'         => 'O',
]);

//Get a channel
$result = $driver->getChannelModel()->getChannelByName('team_id_of_the_channel_to_return', 'new_channel');

//Please read the ChannelModel class or refer to the api documentation for a complete list of available methods.
```

### Posts endpoint

[](#posts-endpoint)

```
//Create a post
$result = $driver->getPostModel()->createPost([
    'channel_id' => 'The channel ID to post in',
    'messages' => 'The message contents, can be formatted with Markdown',
]);

//Get a post
$result = $driver->getPostModel()->getPost('post_id_of_the_post_to_return');

//Please read the PostModel class or refer to the api documentation for a complete list of available methods.
```

### Files endpoint

[](#files-endpoint)

```
//Upload a file
$result = $driver->getFileModel()->uploadFile([
    'channel_id' => 'The ID of the channel that this file will be uploaded to',
    'filename' => 'The name of the file to be uploaded',
    'files' => fopen('Path of the file to be uploaded', 'rb'),
]);

//Send a post with the file just uploaded
$result = $driver->getPostModel()->createPost([
    'channel_id' => 'The channel ID to post in',
    'messages' => 'The message contents, can be formatted with Markdown',
    'file_ids' => 'A list of file IDs to associate with the post',
]);

//Please read the FileModel class or refer to the api documentation for a complete list of available methods.
```

### Preferences endpoint

[](#preferences-endpoint)

```
//Get a list of the user's preferences
$result = $driver->getPreferenceModel('user_id')->getUserPreference();

//Please read the PreferenceModel class or refer to the api documentation for a complete list of available methods.
```

Endpoints supported
-------------------

[](#endpoints-supported)

- [Bots](https://api.mattermost.com/#tag/bots)
- [Brand](https://api.mattermost.com/#tag/brand)
- [Channels](https://api.mattermost.com/#tag/channels)
- [Cluster](https://api.mattermost.com/#tag/cluster)
- [Commands](https://api.mattermost.com/#tag/commands)
- [Compliance](https://api.mattermost.com/#tag/compliance)
- [DataRetention](https://api.mattermost.com/#tag/dataretention)
- [Elasticsearch](https://api.mattermost.com/#tag/elasticsearch)
- [Emoji](https://api.mattermost.com/#tag/emoji)
- [Files](https://api.mattermost.com/#tag/files)
- [Jobs](https://api.mattermost.com/#tag/jobs)
- [LDAP](https://api.mattermost.com/#tag/LDAP)
- [OAuth](https://api.mattermost.com/#tag/OAuth)
- [Plugins](https://api.mattermost.com/#tag/plugins)
- [Posts](https://api.mattermost.com/#tag/posts)
- [Preferences](https://api.mattermost.com/#tag/preferences)
- [Reactions](https://api.mattermost.com/#tag/reactions)
- [Roles](https://api.mattermost.com/#tag/roles)
- [SAML](https://api.mattermost.com/#tag/SAML)
- [Schemes](https://api.mattermost.com/#tag/schemes)
- [Status](https://api.mattermost.com/#tag/status)
- [System](https://api.mattermost.com/#tag/system)
- [Teams](https://api.mattermost.com/#tag/teams)
- [Users](https://api.mattermost.com/#tag/users)
- [Webhooks](https://api.mattermost.com/#tag/webhooks)

Don't you see the endpoint you need? Feel free to open an issue or a PR!

Contact
-------

[](#contact)

-

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 79.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~46 days

Recently: every ~19 days

Total

20

Last Release

2432d ago

Major Versions

v1.3.0 → v2.0.02017-05-14

PHP version history (2 changes)v1.0.0PHP &gt;=5.4.0

v2.4.0PHP &gt;=5.5.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/10077243?v=4)[Aleksandr Avtomonov](/maintainers/avtomon)[@avtomon](https://github.com/avtomon)

---

Top Contributors

[![gnello](https://avatars.githubusercontent.com/u/19245006?v=4)](https://github.com/gnello "gnello (115 commits)")[![prixone](https://avatars.githubusercontent.com/u/13369829?v=4)](https://github.com/prixone "prixone (18 commits)")[![BrunoSpy](https://avatars.githubusercontent.com/u/954222?v=4)](https://github.com/BrunoSpy "BrunoSpy (8 commits)")[![brettmc](https://avatars.githubusercontent.com/u/4978962?v=4)](https://github.com/brettmc "brettmc (1 commits)")[![avtomon](https://avatars.githubusercontent.com/u/10077243?v=4)](https://github.com/avtomon "avtomon (1 commits)")[![jelly](https://avatars.githubusercontent.com/u/67428?v=4)](https://github.com/jelly "jelly (1 commits)")[![scottliddick](https://avatars.githubusercontent.com/u/1240052?v=4)](https://github.com/scottliddick "scottliddick (1 commits)")

---

Tags

chatMattermost

### Embed Badge

![Health badge](/badges/scaleplan-php-mattermost-driver/health.svg)

```
[![Health](https://phpackages.com/badges/scaleplan-php-mattermost-driver/health.svg)](https://phpackages.com/packages/scaleplan-php-mattermost-driver)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[saloonphp/saloon

Build beautiful API integrations and SDKs with Saloon

2.4k9.6M468](/packages/saloonphp-saloon)[theodo-group/llphant

LLPhant is a library to help you build Generative AI applications.

1.5k311.5k5](/packages/theodo-group-llphant)[gnello/php-mattermost-driver

The Php Driver to interact with the Mattermost Web Service API

84304.8k5](/packages/gnello-php-mattermost-driver)[get-stream/stream-chat

A PHP client for Stream Chat (https://getstream.io/chat/)

301.8M2](/packages/get-stream-stream-chat)[yoti/yoti-php-sdk

Yoti SDK for quickly integrating your PHP backend with Yoti

27539.9k1](/packages/yoti-yoti-php-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
