@@ -32,29 +32,55 @@ composer require gnello/php-mattermost-driver:1.*
32
32
#### Login id and password
33
33
``` php
34
34
use \Gnello\Mattermost\Driver;
35
-
36
- // construct your own GuzzleHttp client instance
37
- $guzzle = new GuzzleHttp/Client(...);
38
-
39
- $driver = new Driver($guzzle, [
40
- 'url' => 'your_chat_url',
41
- 'login_id' => 'your_login_id',
42
- 'password' => 'your_password',
43
- ]);
35
+ use Psr\Http\Client\ClientInterface;
36
+ use Psr\Http\Message\RequestFactoryInterface;
37
+ use Psr\Http\Message\StreamFactoryInterface;
38
+
39
+ // construct or discover your own PSR7 instances
40
+ /** @var ClientInterface */
41
+ $httpClient = ...;
42
+ /** @var RequestFactoryInterface */
43
+ $requestFactory = ...;
44
+ /** @var StreamFactoryInterface */
45
+ $streamFactory = ...;
46
+
47
+ $driver = new Driver(
48
+ $httpClient,
49
+ $requestFactory,
50
+ $streamFactory,
51
+ [
52
+ 'url' => 'your_chat_url',
53
+ 'login_id' => 'your_login_id',
54
+ 'password' => 'your_password',
55
+ ]
56
+ );
44
57
$result = $driver->authenticate();
45
58
```
46
59
47
60
#### Token
48
61
``` php
49
- use \Gnello\Mattermost\Driver;
50
-
51
- // construct your own GuzzleHttp client instance
52
- $guzzle = new GuzzleHttp/Client(...);
53
-
54
- $driver = new Driver($guzzle, [
55
- 'url' => 'your_chat_url',
56
- 'token' => 'your_token',
57
- ]);
62
+ use \Gnello\Mattermost\Driver;
63
+ use Psr\Http\Client\ClientInterface;
64
+ use Psr\Http\Message\RequestFactoryInterface;
65
+ use Psr\Http\Message\StreamFactoryInterface;
66
+
67
+ // construct or discover your own PSR7 instances
68
+ /** @var ClientInterface */
69
+ $httpClient = ...;
70
+ /** @var RequestFactoryInterface */
71
+ $requestFactory = ...;
72
+ /** @var StreamFactoryInterface */
73
+ $streamFactory = ...;
74
+
75
+ $driver = new Driver(
76
+ $httpClient,
77
+ $requestFactory,
78
+ $streamFactory,
79
+ [
80
+ 'url' => 'your_chat_url',
81
+ 'token' => 'your_token',
82
+ ]
83
+ );
58
84
59
85
$result = $driver->authenticate();
60
86
```
@@ -198,4 +224,3 @@ Don't you see the endpoint you need? Feel free to open an issue or a PR!
198
224
[ 10 ] : https://github.com/gnello/laravel-mattermost-driver
199
225
[ 11 ] : https://poser.pugx.org/gnello/php-mattermost-driver/downloads
200
226
[ 12 ] : https://packagist.org/packages/gnello/php-mattermost-driver
201
- [ 13 ] : https://docs.guzzlephp.org/en/stable/request-options.html
0 commit comments