iwalkalone/matrix-api

PHP library to interact with Matrix Servers API.

v1.0 2025-09-10 08:59 UTC

This package is not auto-updated.

Last update: 2025-09-11 07:24:00 UTC


README

Description

Library to interact with Matrix servers API.

Install

Install with composer:

composer require iwalkalone/matrix-api

Or a specific version:

composer require iwalkalone/matrix-api ^1.0

How to use it

Authenticate with user and password to obtain an access_token:

$data = \iwalkalone\MatrixAPI::Authenticate("https://127.0.0.1:80", "user", "pass");
if ($data['status'] == 1) {
    $access_token = $data['result']['access_token'];
} else {
    print_r($data['result']); // It contains the error message and error code
}

If you implement an Appservice you can use as_token as access_token in functions.

You can check API specs here:

https://spec.matrix.org/latest/