Skip to content

Commit 05924ef

Browse files
committed
Updated readme adding Installation, usage, and features/roadmap
1 parent f8794f4 commit 05924ef

File tree

1 file changed

+36
-3
lines changed

1 file changed

+36
-3
lines changed

README.md

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,44 @@
77
[![License](https://poser.pugx.org/api-clients/pusher/license.png)](https://packagist.org/packages/api-clients/pusher)
88
[![PHP 7 ready](http://php7ready.timesplinter.ch/php-api-clients/pusher/badge.svg)](https://appveyor-ci.org/php-api-clients/pusher)
99

10+
# Installation
1011

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 `^`.
1213

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
1548

1649
# License
1750

0 commit comments

Comments
 (0)