Update composer.json, guzzle and .gitignore
Additionally update test sources and README.md
This commit is contained in:
parent
70f6273e0e
commit
4bae520305
34
.gitignore
vendored
34
.gitignore
vendored
|
@ -1,6 +1,30 @@
|
|||
build
|
||||
composer.lock
|
||||
vendor
|
||||
phpcs.xml
|
||||
phpunit.xml
|
||||
.idea/
|
||||
.idea/
|
||||
|
||||
# Created by https://www.toptal.com/developers/gitignore/api/phpunit,composer
|
||||
# Edit at https://www.toptal.com/developers/gitignore?templates=phpunit,composer
|
||||
|
||||
### Composer ###
|
||||
composer.phar
|
||||
/vendor/
|
||||
|
||||
# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control
|
||||
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
|
||||
composer.lock
|
||||
|
||||
### PHPUnit ###
|
||||
# Covers PHPUnit
|
||||
# Reference: https://phpunit.de/
|
||||
|
||||
# Generated files
|
||||
.phpunit.result.cache
|
||||
.phpunit.cache
|
||||
|
||||
# PHPUnit
|
||||
/app/phpunit.xml
|
||||
/phpunit.xml
|
||||
|
||||
# Build data
|
||||
/build/
|
||||
|
||||
# End of https://www.toptal.com/developers/gitignore/api/phpunit,composer
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Matrix client SDK for php
|
||||
[![Software License][ico-license]](LICENSE.md)
|
||||
|
||||
This is a Matrix client-server SDK for php 7.0+, mostly copied from [matrix-org/matrix-python-sdk][python-pck]
|
||||
This is a Matrix client-server SDK for php 7.2.5+, mostly copied from [matrix-org/matrix-python-sdk][python-pck]
|
||||
|
||||
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
|
||||
|
@ -42,15 +42,15 @@ $matrix = new MatrixHttpApi("http://localhost:8008", $sometoken);
|
|||
$response = $matrix->sendMessage("!roomid:matrix.org", "Hello!");
|
||||
```
|
||||
|
||||
##Structure
|
||||
## Structure
|
||||
The SDK is split into two modules: ``api`` and ``client``.
|
||||
|
||||
###API
|
||||
### 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
|
||||
### Client
|
||||
This encapsulates the API module and provides object models such as ``Room``.
|
||||
|
||||
|
||||
|
|
|
@ -19,13 +19,14 @@
|
|||
"aryess/phpmatrixsdk": "self.version"
|
||||
},
|
||||
"require": {
|
||||
"php": "~7.2",
|
||||
"guzzlehttp/guzzle": "^6.3",
|
||||
"php": "^7.2.5 || ^8.0",
|
||||
"guzzlehttp/guzzle": "7.2.0",
|
||||
"rappasoft/laravel-helpers": "^1.0",
|
||||
"ext-json": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit" : ">=5.4.3"
|
||||
"phpunit/php-code-coverage": "^7.0",
|
||||
"phpunit/phpunit": "^8.5"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
@ -46,6 +47,9 @@
|
|||
}
|
||||
},
|
||||
"config": {
|
||||
"sort-packages": true
|
||||
"sort-packages": true,
|
||||
"platform": {
|
||||
"php": "7.2.5"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ class MatrixHttpApiTest extends BaseTestCase {
|
|||
*/
|
||||
protected $api;
|
||||
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
parent::setUp();
|
||||
$this->api = new MatrixHttpApi('http://example.com');
|
||||
}
|
||||
|
@ -374,7 +374,7 @@ class MatrixHttpApiTest extends BaseTestCase {
|
|||
$req = array_get($container, '0.request');
|
||||
|
||||
$this->assertEquals('GET', $req->getMethod());
|
||||
$this->assertContains($this->token, $req->getRequestTarget());
|
||||
$this->assertStringContainsString($this->token, $req->getRequestTarget());
|
||||
}
|
||||
|
||||
public function testSendUserId() {
|
||||
|
@ -390,7 +390,7 @@ class MatrixHttpApiTest extends BaseTestCase {
|
|||
$req = array_get($container, '0.request');
|
||||
|
||||
$this->assertEquals('GET', $req->getMethod());
|
||||
$this->assertContains(urlencode($this->userId), $req->getRequestTarget());
|
||||
$this->assertStringContainsString(urlencode($this->userId), $req->getRequestTarget());
|
||||
}
|
||||
|
||||
public function testSendUnsupMethod() {
|
||||
|
@ -554,7 +554,7 @@ class MatrixHttpApiTest extends BaseTestCase {
|
|||
$req = array_get($container, '0.request');
|
||||
|
||||
$this->assertEquals('GET', $req->getMethod());
|
||||
$this->assertContains($req->getRequestTarget(), $whoamiUrl);
|
||||
$this->assertStringContainsString($req->getRequestTarget(), $whoamiUrl);
|
||||
}
|
||||
|
||||
public function testWhoamiUnauth() {
|
||||
|
@ -569,4 +569,4 @@ class MatrixHttpApiTest extends BaseTestCase {
|
|||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ class UserTest extends BaseTestCase {
|
|||
*/
|
||||
protected $room;
|
||||
|
||||
protected function setUp() {
|
||||
protected function setUp(): void {
|
||||
parent::setUp();
|
||||
$this->client = new MatrixClient(self::HOSTNAME);
|
||||
$this->user = new User($this->client->api(), $this->userId);
|
||||
|
@ -61,4 +61,4 @@ class UserTest extends BaseTestCase {
|
|||
$this->assertEquals(1, count($container));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue