{"id":51133847,"url":"https://github.com/joho1968/matrix-php","last_synced_at":"2026-06-25T15:30:53.936Z","repository":{"id":365021370,"uuid":"1269979838","full_name":"joho1968/matrix-php","owner":"joho1968","description":"Reusable PHP 8.4+ library for Matrix/Synapse Application Service and Admin API integration","archived":false,"fork":false,"pushed_at":"2026-06-15T15:07:26.000Z","size":32,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-15T15:17:42.076Z","etag":null,"topics":["matrix","matrix-library","matrix-synapse","no-framework","php","php8","php84","synapse"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/joho1968.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,"zenodo":null,"notice":"NOTICE","maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-15T09:15:52.000Z","updated_at":"2026-06-15T15:08:04.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/joho1968/matrix-php","commit_stats":null,"previous_names":["joho1968/matrix-php"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/joho1968/matrix-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joho1968%2Fmatrix-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joho1968%2Fmatrix-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joho1968%2Fmatrix-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joho1968%2Fmatrix-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joho1968","download_url":"https://codeload.github.com/joho1968/matrix-php/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joho1968%2Fmatrix-php/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34781499,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-25T02:00:05.521Z","response_time":101,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["matrix","matrix-library","matrix-synapse","no-framework","php","php8","php84","synapse"],"created_at":"2026-06-25T15:30:53.419Z","updated_at":"2026-06-25T15:30:53.930Z","avatar_url":"https://github.com/joho1968.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# matrix-php\n\n**Version 0.93.1** — [Changelog](CHANGELOG.md) — [Source](https://codeberg.org/joho1968/matrix-php)\n\nReusable PHP 8.2+ library for interacting with a Matrix/Synapse homeserver.\nProvides an Application Service client (`MatrixClient`) for sending events and\nmanaging rooms/users, and a Synapse Admin API client (`SynapseAdminClient`) for\nadministrative operations. No framework dependencies.\n\n## Requirements\n\n- PHP 8.2+\n- `ext-curl`\n\n## Installation\n\nAs a Composer path dependency:\n\n```json\n{\n    \"repositories\": [\n        {\n            \"type\": \"path\",\n            \"url\": \"../matrix-php\",\n            \"options\": { \"symlink\": false }\n        }\n    ],\n    \"require\": {\n        \"joho/matrix-php\": \"dev-main\"\n    },\n    \"minimum-stability\": \"dev\",\n    \"prefer-stable\": true\n}\n```\n\n## MatrixClient\n\nSends events and manages rooms and users via the Application Service API.\nRequires an AS access token (`as_token` from the registration YAML).\n\n```php\nuse Joho\\Matrix\\Client\\MatrixClient;\nuse Joho\\Matrix\\Http\\HttpClient;\n\n$client = new MatrixClient(\n    http:          new HttpClient(),\n    homeserverUrl: 'https://matrix.example.com',\n    asToken:       'your_as_token',\n    serverName:    'example.com',\n);\n\n// Register a user\n$user = $client-\u003eregisterUser( 'alice' );\n\n// Create a room as alice\n$room = $client-\u003ecreateRoom(\n    [ 'name' =\u003e 'General', 'preset' =\u003e 'private_chat' ],\n    $user-\u003egetUserId(),\n);\n\n// Send a message with a historical timestamp (ms)\n$client-\u003esendEvent(\n    $room-\u003egetRoomId(),\n    'm.room.message',\n    [ 'msgtype' =\u003e 'm.text', 'body' =\u003e 'Hello' ],\n    $user-\u003egetUserId(),\n    1_700_000_000_000,\n);\n```\n\n## SynapseAdminClient\n\nWraps the `/_synapse/admin/*` endpoints for user, room, media, token, and\nfederation management. Requires an admin user's access token.\n\n```php\nuse Joho\\Matrix\\Client\\SynapseAdminClient;\nuse Joho\\Matrix\\Http\\HttpClient;\n\n$admin = new SynapseAdminClient(\n    http:          new HttpClient(),\n    homeserverUrl: 'https://matrix.example.com',\n    adminToken:    'syt_...',\n);\n\n$users = $admin-\u003elistUsers( limit: 50 );\n$admin-\u003edeactivateUser( '@alice:example.com', erase: true );\n$admin-\u003edeleteRoom( '!abc:example.com', purge: true );\n```\n\nSee `src/Contracts/SynapseAdminClientInterface.php` for the full method list.\n\n## Logging\n\n`FileLogger` and `ConsoleLogger` both implement `LoggerInterface` and accept a\nminimum log level (`debug`, `info`, `warning`, `error`). `FileLogger` appends to\na file; `ConsoleLogger` writes `info`/`debug` to STDOUT and `warning`/`error`\nto STDERR.\n\n```php\nuse Joho\\Matrix\\Logger\\FileLogger;\n\n$logger = new FileLogger( '/var/log/matrix.log', 'info' );\n```\n\n## Projects using this library\n\n- [Into The Matrix (ITM)](https://codeberg.org/joho1968/into-the-matrix) — Mattermost Bulk Export to Matrix/Synapse migration tool\n- [mtxctl](https://codeberg.org/joho1968/mtxctl) — Matrix/Synapse admin CLI tool\n\n## License\n\nGNU Affero General Public License v3.0 or later. See `LICENSE`.\n\n## Copyright\n\nWritten by Joaquim Homrighausen while converting caffeine into code.\nCopyright 2026 Joaquim Homrighausen; all rights reserved.\n\nSponsored by WebbPlatsen i Sverige AB, Sweden.\n\nIf you need a GDPR-safe place to host your Matrix, Mattermost, and/or\nRocketChat instance, get in touch with support@webbplatsen.se\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoho1968%2Fmatrix-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoho1968%2Fmatrix-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoho1968%2Fmatrix-php/lists"}