Skip to content

Commit

Permalink
Merge pull request #13 from jcroll/guzzle4
Browse files Browse the repository at this point in the history
[RFC] Guzzle 4
  • Loading branch information
jcroll authored Aug 26, 2016
2 parents 1a7ac74 + d0991a2 commit 321f88c
Show file tree
Hide file tree
Showing 7 changed files with 517 additions and 266 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
language: php
php:
- 5.3
- 5.4
- 5.5
- 5.6
Expand Down
28 changes: 18 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,23 @@ and as such installable via [Composer](http://getcomposer.org/).
If you do not use Composer, you can grab the code from GitHub, and use any PSR-0 compatible autoloader
(e.g. the [Symfony2 ClassLoader component](https://github.com/symfony/ClassLoader)) to load the library's classes.

### Guzzle Versioning

This package is compatible with different versions of Guzzle (see below):

| Guzzle Version | Foursquare Client Version |
|----------------|---------------------------|
| ~3 | ~1 |
| ~4 | ~2 |

### Composer example

Add JcrollFoursquareApiBundle in your composer.json:

```js
{
"require": {
"jcroll/foursquare-api-client": "~1"
"jcroll/foursquare-api-client": "~2"
}
}
```
Expand All @@ -48,16 +57,16 @@ require_once 'vendor/autoload.php';
```php
use Jcroll\FoursquareApiClient\Client\FoursquareClient;

$client = FoursquareClient::factory(array(
$client = FoursquareClient::factory([
'client_id' => 'your_foursquare_client_id', // required
'client_secret' => 'your_foursquare_client_secret' // required
));
]);
$client->addToken($oauthToken); // optionally pass in for user specific requests
$command = $client->getCommand('venues/search', array(
'near' => 'Chicago, IL',
$command = $client->getCommand('venues/search', [
'near' => 'Chicago, IL',
'query' => 'sushi'
));
$results = $command->execute(); // returns an array of results
]);
$results = (array) $client->execute($command); // returns an array of results
```

You can find a list of the client's available commands in the bundle's
Expand All @@ -67,6 +76,5 @@ they should be the same as the [api endpoints listed in the docs](https://develo
## Oauth Integration

Endpoints in the foursquare API that are user specific will require authorization with foursquare using the Oauth 2.0 protocol. This type
of authorization is beyond the scope of this library as there are better libraries for that such as the [FriendsOfSymfony Oauth2
Server](https://github.com/FriendsOfSymfony/oauth2-php). After authorization you can pass the access token into the client for user
specific access.
of authorization is beyond the scope of this library as there are better libraries for [that](https://packagist.org/search/?q=oauth).
After authorization you can pass the access token into the client for user specific access.
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
}
],
"require": {
"php": ">=5.3.3",
"guzzlehttp/guzzle": ">=3.7 <4.0"
"php": ">=5.4",
"guzzlehttp/guzzle": "~4",
"guzzlehttp/guzzle-services": "0.3"
},
"require-dev": {
"phpunit/phpunit": "~4.8"
"phpunit/phpunit": "~4.8|^5"
},
"autoload": {
"psr-4": {
Expand Down
Loading

0 comments on commit 321f88c

Please sign in to comment.