Skip to content
On this page


swaggercodecovphpunitdownloadsdownloadsdownloadsMaintainabilityTest Coverage

What does it do

This package is used for Mattermost integration.

It listens for Events then add/remove user for mattermost and particular channels either as standard user or admin.


  • composer require escolalms/mattermost


You can configure the package using Facade

Config::set('mattermost.package_status', PackageStatusEnum::ENABLED);
Config::set('', 'localhost');
Config::set('mattermost.servers.default.login', 'login');
Config::set('mattermost.servers.default.password', 'password');

or /api/admin/config endpoint

$this->actingAs($this->user, 'api')->json(
        'config' => [
                'key' => 'mattermost.package_status',
                'value' => PackageStatusEnum::ENABLED,
                'key' => '',
                'value' => 'localhost',
                'key' => 'mattermost.servers.default.login',
                'value' => 'login',
                'key' => 'mattermost.servers.default.password',
                'value' => 'password',


All the endpoints are defined in swagger


Run ./vendor/bin/phpunit to run tests. See tests folder as it's quite good staring point as documentation appendix. Test details codecovphpunit


Handling events

  • EscolaLms\Auth\Events\AccountConfirmed => add user to Mattermost
  • EscolaLms\Auth\Events\AccountDeleted => remove user from Mattermost
  • EscolaLms\Auth\Events\AccountBlocked => block user account
  • EscolaLms\Courses\Events\CourseAssigned => add user to course channel with member role
  • EscolaLms\Courses\Events\CourseUnassigned => remove user from course channel
  • EscolaLms\Courses\Events\CourseTutorAssigned => add user to course channel with channel_admin role
  • EscolaLms\Courses\Events\CourseTutorUnassigned => remove user from course channel
  • EscolaLms\Webinar\Events\WebinarUserAssigned => add user to webinar channel with member role
  • EscolaLms\Webinar\Events\WebinarUserUnassigned => remove user from webinar channel
  • EscolaLms\Webinar\Events\WebinarTrainerAssigned => add user to webinar channel with channel_admin role
  • EscolaLms\Webinar\Events\WebinarTrainerUnassigned => remove user from webinar channel