PHP SDK for Matrix.org
Go to file
Chris Burgess df5e341a80 chore: Remove support for PHP < 7.4
These are EOL PHP versions which don't pass Travis CI checks. They may
still work, but they are no longer tested after this commit.

Evidence: https://github.com/xurizaemon/matrix-php-sdk/runs/6935299663
2022-06-23 21:20:33 +10:00
src Fix misspellings and deprecations in HTTP API class 2022-06-23 21:20:33 +10:00
tests correct assertion to check string containment 2022-06-23 21:20:33 +10:00
.editorconfig Initial Commit 2022-06-23 21:20:13 +10:00
.gitattributes Initial Commit 2022-06-23 21:20:13 +10:00
.gitignore Adjusting settings 2022-06-23 21:20:33 +10:00
.scrutinizer.yml Initial Commit 2022-06-23 21:20:13 +10:00
.travis.yml chore: Remove support for PHP < 7.4 2022-06-23 21:20:33 +10:00
CHANGELOG.md Prefilling info 2022-06-23 21:20:33 +10:00
CODE_OF_CONDUCT.md Prefilling info 2022-06-23 21:20:33 +10:00
CONTRIBUTING.md Prefilling info 2022-06-23 21:20:33 +10:00
ISSUE_TEMPLATE.md Initial Commit 2022-06-23 21:20:13 +10:00
LICENSE.md Prefilling info 2022-06-23 21:20:33 +10:00
PULL_REQUEST_TEMPLATE.md Initial Commit 2022-06-23 21:20:13 +10:00
README.md Update README to reference packagist and replace must also be fully lowercase 2022-06-23 21:20:33 +10:00
composer.json PHP 8 2022-06-23 21:20:33 +10:00
phpunit.xml.dist Preparing for tests 2022-06-23 21:20:33 +10:00
prefill.php Initial Commit 2022-06-23 21:20:13 +10:00

README.md

Matrix client SDK for php

Software License

This is a Matrix client-server SDK for php 7.0+, mostly copied from matrix-org/matrix-python-sdk

This package is still a work in progress, and at the current time, not everything has been ported:

  • Missing E2E encryption, need php bindings for the OLM library
  • No live sync, because I'm not going to go into php multithreading
  • Unit tests for the client

Installation

composer require aryess/php-matrix-sdk

Usage

Client:

require('vendor/autoload.php');
use Aryess\PhpMatrixSdk\MatrixClient;

$client = new MatrixClient("http://localhost:8008");

// New user
$token = $client->registerWithPassword("foobar", "monkey");

// Existing user
$token = $client->login("foobar", "monkey");

$room = $client->createRoom("my_room_alias");
$room->sendText("Hello!");

API:

require('vendor/autoload.php');
use Aryess\PhpMatrixSdk\MatrixHttpApi;

$matrix = new MatrixHttpApi("http://localhost:8008", $sometoken);

$response = $matrix->sendMessage("!roomid:matrix.org", "Hello!");

##Structure The SDK is split into two modules: api and client.

###API This contains the raw HTTP API calls and has minimal business logic. You can set the access token (token) to use for requests as well as set a custom transaction ID (txn_id) which will be incremented for each request.

###Client This encapsulates the API module and provides object models such as Room.

Contributing

Please see CONTRIBUTING and CODE_OF_CONDUCT for details.

Security

If you discover any security related issues, please email aryess@github.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.