This project implements an endpoint for bug reports from the Android and iOS apps of Element in PHP. It was developed for the Synod.im branded forks of these apps (Android, iOS), though it is fully compatible with the upstream protocol.
Different bug report handlers are available. Additional ones can
be developed easily by implementing
BugReportHandlerInterface
.
Run composer require synod/bug-report
. Then create a PHP file that handles
POST
requests to an URL with /submit
as last part containing the following:
<?php
use Synod\BugReport\BugReportRequest;
use Synod\BugReport\Controller\BugReportController;
require_once '/path/to/vendor/autoload.php';
$handler = <Implementation of Synod\BugReport\Handler\BugReportHandlerInterface>;
$logger = <Implementation of Psr\Log\LoggerInterface>; // optional
$bugReportController = new BugReportController($handler, $logger);
$request = BugReportRequest::createFromGlobals();
$response = $bugReportController->handleRequest($request);
$response->send();
Element sends a multipart form using the same field names multiple times. This
is not supported by PHP's builtin parser so it has to be disabled by setting the
php.ini
directive enable_post_data_reading
to Off
. How to do this depends
on the webserver (e.g. .user.ini
or .htaccess
).
You might consider to enable rate limiting by using
RateLimitingBugReportController
.
Finally change the URLs to which the Android and iOS apps send the bug reports.
For Android do this in
config.xml
.
For iOS do this in
BuildSettings.swift
.
Please note that the path /submit
is appended by the iOS Matrix
SDK.