8000 Update README.md · clue/reactphp-packagist-api@dc65913 · GitHub
[go: up one dir, main page]

Skip to content

Commit dc65913

Browse files
committed
Update README.md
1 parent 92499fa commit dc65913

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

README.md

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ See also the [examples](examples).
3838
### Client
3939

4040
The `Client` is responsible for assembling and sending HTTP requests to the remote Packagist API.
41-
It requires a `Browser` object bound to the main `EventLoop` in order to handle async requests:
41+
It requires a [`Browser`](https://github.com/clue/php-buzz-react#browser) object
42+
bound to the main [`EventLoop`](https://github.com/reactphp/event-loop#usage)
43+
in order to handle async requests:
4244

4345
```php
4446
$loop = React\EventLoop\Factory::create();
@@ -47,12 +49,19 @@ $browser = new Clue\React\Buzz\Browser($loop);
4749
$client = new Client($browser);
4850
```
4951

52+
If you need custom DNS or proxy settings, you can explicitly pass a
53+
custom [`Browser`](https://github.com/clue/php-buzz-react#browser) instance.
54+
55+
#### Processing
56+
5057
All public methods on the `Client` resemble the API provided by [KnpLab's `packagist-api`](https://github.com/KnpLabs/packagist-api),
5158
except for an async shift in their return values.
5259
Sending requests is async (non-blocking), so you can actually send multiple requests in parallel.
5360
Packagist will respond to each request with a response message, the order is not guaranteed.
5461
Sending requests uses a [Promise](https://github.com/reactphp/promise)-based interface that makes it easy to react to when a request is fulfilled (i.e. either successfully resolved or rejected with an error).
5562

63+
#### search()
64+
5665
The `search($query, $filters = array())` method can be used to search packages matching the given query string and optionally matching the given filter parameter.
5766
It resolves with an array containing zero or more `Package` objects.
5867

@@ -64,6 +73,8 @@ $client->search('packagist')->then(function ($results) {
6473
});
6574
```
6675

76+
#### get()
77+
6778
The `get($name)` method can be used to get package details for the given package name.
6879
It resolves with a single `Package` object.
6980

@@ -73,6 +84,8 @@ $client->get('clue/packagist-api-react')->then(function (Package $package) {
7384
});
7485
```
7586

87+
#### all()
88+
7689
The `all($filters = array())` method an be used to list all package names, optionally matching the given filter parameter.
7790
It resolves with an array of package names.
7891

@@ -88,11 +101,15 @@ The `Package` class represents information about a given composer package.
88101
This class is part of the underlying [KnpLab/packagist-api](https://github.com/KnpLabs/packagist-api),
89102
its full name is actually `Packagist\Api\Result\Package`.
90103

104+
See its class outline for all available methods.
105+
106+
#### getName()
107+
91108
The `getName()` method can be used to get the package name.
92109

93-
The `getDescription()` method can be used to the package description.
110+
#### getDescription()
94111

95-
See the class outline for all available methods.
112+
The `getDescription()` method can be used to the package description.
96113

97114
## Install
98115

0 commit comments

Comments
 (0)
0