Skip to content

Commit

Permalink
chore: add fiels param in readme and phpdoc (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yizack authored Jul 22, 2024
1 parent e583e7f commit af00cb3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ foreach ($feed->getFeed() as $value) {
}
```

The `getFeed()` function also accepts a comma-separated list of fields to be returned.
```php
$array = $feed->getFeed("username,permalink,timestamp,caption,media_url");
```

For a list of all available fields see: https://developers.facebook.com/docs/instagram-basic-display-api/reference/media#fields

## About the code
### `InstagramFeed` constructor arguments

Expand Down
8 changes: 8 additions & 0 deletions src/InstagramFeed.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ protected function refreshToken() {
}
}

/**
* Get Instagram feed
*
* For a list of all available fields see: https://developers.facebook.com/docs/instagram-basic-display-api/reference/media#fields
*
* @param string|null $fields Comma-separated list of fields to retrieve. Defaults to 'username,permalink,timestamp,caption'.
* @return array The Instagram feed data.
*/
function getFeed($fields = null) {
$fields = $fields ?? 'username,permalink,timestamp,caption';
$this->refreshToken();
Expand Down

0 comments on commit af00cb3

Please sign in to comment.