Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Cjbenavides88 fetch media item comments #102

Merged
merged 3 commits into from
Apr 11, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ You may pass [additional query parameters](https://www.instagram.com/developer/e
$instagram->media(['count' => 5]);
```

To fetch media item comments you may use the `comments()` and you must pass [media-id](https://www.instagram.com/developer/endpoints/comments/#get_media_comments) to the method.

```php
$instagram->comments('2002428153830184058_1444398142');
```

To fetch the user information data you may use the `self()` method.

```php
Expand Down
14 changes: 14 additions & 0 deletions src/Instagram.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,20 @@ public function media(array $parameters = []): array

return $response->data;
}

/**
* Fetch comments from media item.
*
* @param string $mediaID
*
* @return array
*/
public function comments(string $mediaID) : array
{
$response = $this->get('media/'.$mediaID.'/comments');

return $response->data;
}

/**
* Fetch user information.
Expand Down