mantis-matrix-integration – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | # Matrix client SDK for PHP |
2 | |||
3 | This package is a fork of the now-abandoned original by [Yoann Celton](https://github.com/Aryess). The architecture does not necessarily reflect best practice in the eyes of current maintainers. Incremental improvements are made as time and resources allow. Contributions are welcome. |
||
4 | |||
5 | --- |
||
6 | |||
7 | [![Software License][ico-license]](LICENSE.md) |
||
8 | [![Software Version][ico-version]](https://packagist.org/packages/meet-kinksters/php-matrix-sdk) |
||
9 | ![Software License][ico-downloads] |
||
10 | |||
11 | This is a Matrix client-server SDK for php 7.4+, initially copied from |
||
12 | [matrix-org/matrix-python-sdk][python-pck]. |
||
13 | |||
14 | This package is still a work in progress, and at the current time, not everything has been ported: |
||
15 | - Missing E2E encryption, need php bindings for the OLM library |
||
16 | - Live sync |
||
17 | - Unit tests for the client |
||
18 | |||
19 | ## Installation |
||
20 | |||
21 | ``` |
||
22 | composer require meet-kinksters/php-matrix-sdk |
||
23 | ``` |
||
24 | |||
25 | ## Usage |
||
26 | Client: |
||
27 | ```php |
||
28 | require('vendor/autoload.php'); |
||
29 | use MatrixPhp\MatrixClient; |
||
30 | |||
31 | $client = new MatrixClient("http://localhost:8008"); |
||
32 | |||
33 | // New user |
||
34 | $token = $client->registerWithPassword("foobar", "monkey"); |
||
35 | |||
36 | // Existing user |
||
37 | $token = $client->login("foobar", "monkey"); |
||
38 | |||
39 | $room = $client->createRoom("my_room_alias"); |
||
40 | $room->sendText("Hello!"); |
||
41 | ``` |
||
42 | |||
43 | API: |
||
44 | ```php |
||
45 | require('vendor/autoload.php'); |
||
46 | use MatrixPhp\MatrixHttpApi; |
||
47 | |||
48 | $matrix = new MatrixHttpApi("http://localhost:8008", $sometoken); |
||
49 | |||
50 | $response = $matrix->sendMessage("!roomid:matrix.org", "Hello!"); |
||
51 | ``` |
||
52 | |||
53 | ##Structure |
||
54 | The SDK is split into two modules: ``api`` and ``client``. |
||
55 | |||
56 | ###API |
||
57 | This contains the raw HTTP API calls and has minimal business logic. You can |
||
58 | set the access token (``token``) to use for requests as well as set a custom |
||
59 | transaction ID (``txn_id``) which will be incremented for each request. |
||
60 | |||
61 | ###Client |
||
62 | This encapsulates the API module and provides object models such as ``Room``. |
||
63 | |||
64 | ## Contributing |
||
65 | |||
66 | Please see [CONTRIBUTING](CONTRIBUTING.md) and [CODE_OF_CONDUCT](CODE_OF_CONDUCT.md) for details. |
||
67 | |||
68 | ## Security |
||
69 | |||
70 | If you discover any security related issues, please email brad@kinksters.dating |
||
71 | instead of using the issue tracker. |
||
72 | |||
73 | ## Credits |
||
74 | |||
75 | - [Brad Jones](https://github.com/bradjones1) at [Meet Kinksters](https://tech.kinksters.dating) |
||
76 | - [Yoann Celton](https://github.com/Aryess) (initial port) |
||
77 | - [All Contributors](https://github.com/meet-kinksters/php-matrix-sdk/graphs/contributors) |
||
78 | |||
79 | ## License |
||
80 | |||
81 | [MIT License](LICENSE.md). |
||
82 | |||
83 | [ico-version]: https://img.shields.io/packagist/v/meet-kinksters/php-matrix-sdk.svg?style=flat-square |
||
84 | [ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square |
||
85 | [ico-downloads]: https://img.shields.io/packagist/dt/meet-kinksters/php-matrix-sdk.svg?style=flat-square |
||
86 | [python-pck]: https://github.com/matrix-org/matrix-python-sdk |