File tree Expand file tree Collapse file tree 1 file changed +36
-3
lines changed Expand file tree Collapse file tree 1 file changed +36
-3
lines changed Original file line number Diff line number Diff line change 7
7
[ ![ License] ( https://poser.pugx.org/api-clients/pusher/license.png )] ( https://packagist.org/packages/api-clients/pusher )
8
8
[ ![ PHP 7 ready] ( http://php7ready.timesplinter.ch/php-api-clients/pusher/badge.svg )] ( https://appveyor-ci.org/php-api-clients/pusher )
9
9
10
+ # Installation
10
11
11
- # Goals
12
+ To install via [ Composer ] ( http://getcomposer.org/ ) , use the command below, it will automatically detect the latest version and bind it with ` ^ ` .
12
13
13
- * 100% Pusher API support
14
- * Both synchronous and asynchronous
14
+ ``` bash
15
+ composer require api-clients/pusher
16
+ ```
17
+
18
+ # Usage
19
+
20
+ ``` php
21
+ $loop = Factory::create();
22
+ $client = AsyncClient::create($loop, 'Application ID here');
23
+
24
+ $client->channel($subReddit)->subscribe(
25
+ function (Event $event) { // Gets called for each incoming event
26
+ echo 'Channel: ', $event->getChannel(), PHP_EOL;
27
+ echo 'Event: ', $event->getEvent(), PHP_EOL;
28
+ echo 'Data: ', json_encode($event->getData()), PHP_EOL;
29
+ },
30
+ function ($e) { // Gets called on errors
31
+ echo (string)$e;
32
+ },
33
+ function () { // Gets called when the end of the stream is reached
34
+ echo 'Done!', PHP_EOL;
35
+ }
36
+ );
37
+ ```
38
+
39
+ For more examples see the [ examples directory] ( examples ) .
40
+
41
+ # Features
42
+
43
+ This project aims to be 100% compatible with [ Pusher's features] ( https://pusher.com/features ) in ` v1.2 ` .
44
+
45
+ - [X] Subscribe to channels
46
+ - [ ] Presence channels
47
+ - [ ] Authentication
15
48
16
49
# License
17
50
You can’t perform that action at this time.
0 commit comments