A PHP Matrix API using cURL.
Find a file
2025-09-10 10:59:56 +02:00
src First version. 2025-09-10 10:59:56 +02:00
.gitignore First version. 2025-09-10 10:59:56 +02:00
composer.json First version. 2025-09-10 10:59:56 +02:00
README.md First version. 2025-09-10 10:59:56 +02:00

cURL

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/