{"id":16233202,"url":"https://github.com/thepanz/mattermostclient","last_synced_at":"2025-03-16T12:32:23.710Z","repository":{"id":57043133,"uuid":"94547735","full_name":"thePanz/MattermostClient","owner":"thePanz","description":"A PHP Mattermost API client build on top of HTTPlug library","archived":false,"fork":false,"pushed_at":"2023-12-20T14:24:41.000Z","size":172,"stargazers_count":28,"open_issues_count":0,"forks_count":11,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-05-21T13:06:27.200Z","etag":null,"topics":["httplug","mattermost","php7"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thePanz.png","metadata":{"files":{"readme":"readme.md","changelog":"changelog.md","contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-06-16T13:43:06.000Z","updated_at":"2024-03-07T19:08:31.000Z","dependencies_parsed_at":"2023-12-20T15:50:29.536Z","dependency_job_id":"852a9e38-1590-419c-8b89-9e327ddb9214","html_url":"https://github.com/thePanz/MattermostClient","commit_stats":{"total_commits":71,"total_committers":4,"mean_commits":17.75,"dds":0.09859154929577463,"last_synced_commit":"40de52c76bab27c87ec2e7bfe53d96d029082380"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thePanz%2FMattermostClient","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thePanz%2FMattermostClient/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thePanz%2FMattermostClient/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thePanz%2FMattermostClient/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thePanz","download_url":"https://codeload.github.com/thePanz/MattermostClient/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221663623,"owners_count":16859871,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["httplug","mattermost","php7"],"created_at":"2024-10-10T13:11:47.558Z","updated_at":"2024-10-27T10:34:07.602Z","avatar_url":"https://github.com/thePanz.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mattermost API Client\n\n[![Latest Version](https://img.shields.io/github/release/thePanz/MattermostClient.svg)](https://github.com/thePanz/MattermostClient/releases)\n[![Build Status](https://img.shields.io/travis/thePanz/MattermostClient.svg)](https://travis-ci.org/thePanz/MattermostClient)\n[![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/thePanz/MattermostClient.svg)](https://scrutinizer-ci.com/g/thePanz/MattermostClient)\n[![Quality Score](https://img.shields.io/scrutinizer/g/thePanz/MattermostClient.svg)](https://scrutinizer-ci.com/g/thePanz/MattermostClient)\n[![Total Downloads](https://img.shields.io/packagist/dt/pnz/mattermost-client.svg)](https://packagist.org/packages/pnz/mattermost-client)\n\nA PHP library providing a client for the REST API v4 of [Mattermost](https://www.mattermost.org).\n\nThis library allows developers to use Mattermost data as objects via a set of specific Models.\nData related to Team, Channel, User, Posts and so on are converted to model objects to be easily used\nand manipulated. Error responses from the Mattermost API are also handled as specific domain exceptions.\n\nYour IDE will be able to auto-complete and suggest model properties, thus lowering the\nbarrier to start using the Mattermost APIs without reading the extensive API documentation.\n\nFollowing the example of [Friends of Api](https://github.com/FriendsOfApi/boilerplate) this library allows\ndevelopers to use and extend the `Hydrators` used to parse the API responses.\nThose are responsible to transform the JSON returned by the API into Models (by default) or into other\nresponse types.\n\nModel `builders` are included to facilitate the creation/update of models via the API. \n\nRefer to the [Changelog](https://github.com/thePanz/MattermostClient/blob/master/changelog.md) for the list of\nchanges.\nThe list of supported APIs endpoints are available in this [Google Spreadsheet](https://docs.google.com/spreadsheets/d/1mLH2aYC8mMv8sLf_mZWxW8H-67juDYJ9M8dCxwWXdf4/edit?usp=sharing) document.\n\n## Installation\n\n**TL;DR**\n```bash\ncomposer require php-http/curl-client nyholm/psr7 php-http/message pnz/mattermost-client\n```\n\nThis library does not have a dependency on Guzzle or any other library that sends HTTP requests. We use the awesome \nHTTPlug to achieve the decoupling. We want you to choose what library to use for sending HTTP requests. Consult this list \nof packages that support [php-http/client-implementation](https://packagist.org/providers/php-http/client-implementation) \nfind clients to use. For more information about virtual packages please refer to \n[HTTPlug](http://docs.php-http.org/en/latest/httplug/users.html). Example:\n\n```bash\ncomposer require php-http/curl-client\n```\n\nYou do also need to install a PSR-7 implementation and a factory to create PSR-7 messages (PSR-17 whenever that is \nreleased). You could use Nyholm PSR-7 implementation and factories from php-http:\n\n```bash\ncomposer require nyholm/psr7 php-http/message\n```\n\nNow you may install the library by running the following:\n\n```bash\ncomposer require pnz/mattermost-client\n```\n\n## Usage example\n\n``` php\n\u003c?php\n\nrequire_once 'vendor/autoload.php';\n\n$endpoint = 'http://mattermostserver.ext/api/v4';\n$username = 'username';\n$password = 'password';\n\n$configurator = (new HttpClientConfigurator())\n    -\u003esetEndpoint($endpoint)\n    -\u003esetCredentials($username, $password);\n$apiClient =  ApiClient::configure($configurator);\n\ntry {\n    // Get the currently logged-in User; the \"me\" ID is a special one, as documented on Mattermost.org APIs.\n    $user = $apiClient-\u003eusers()-\u003egetUserById('me');\n    var_dump($user-\u003egetUsername());\n\n```\n\n### Handling Mattermost entities\n\nSpecific Model Builders are available to help the creation of Mattermost entities.\n\nAs an example, to create a Team use a `TeamBuilder()` instance, add the desired fields and call `build()`\nto obtain the data needed to invoke the `createTeam()` API.\n\nCreate a Team:\n``` php\nuse Pnz\\MattermostClient\\Model\\Team;\n\n$teamData = (new Team\\TeamBuilder())\n    -\u003esetDisplayName('Team 01')\n    -\u003esetName('team-01')\n    -\u003esetType(Team\\Team::TEAM_INVITE_ONLY)\n    -\u003ebuild();\n\n$team = $apiClient-\u003eteams()-\u003ecreateTeam($teamData);\n```\n\nThe model builders can also be used to generate the data required to update or to patch a Mattermost entity.\n\nPatch a Post:\n``` php\n\u003c?php\nuse Pnz\\MattermostClient\\Model\\Post;\n\n$post = $apiClient-\u003eposts()-\u003egetPost('zhcapisftibyjnf54gixg3hdew');\n$postData = (new Post\\PostBuilder())\n    -\u003esetMessage('I can `format` the _text_ of a *message*, including [links](www.mattermost.com)')\n    -\u003esetIsPinned(true)\n    -\u003ebuild(Post\\PostBuilder::BUILD_FOR_PATCH);\n\n$post = $apiClient-\u003eposts()-\u003epatchPost($post-\u003egetId(), $postData);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthepanz%2Fmattermostclient","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthepanz%2Fmattermostclient","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthepanz%2Fmattermostclient/lists"}