An easy-to-use and simple Instagram package
Branch: master
Clone or download
Latest commit 9b78701 Feb 17, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Refactor api url method Feb 15, 2019
tests ⬆️ phpunit/phpunit Feb 15, 2019
.editorconfig Add .editorconfig May 26, 2016
.gitattributes Update .gitattributes Oct 16, 2018
.gitignore Update gitignore May 26, 2015
.styleci.yml Create .styleci.yml Oct 18, 2016
.travis.yml Test php 7.3 Oct 20, 2018
CHANGELOG.md Release version 9.2.0 Feb 17, 2019
CONTRIBUTING.md Update the contributing guidelines Jan 1, 2017
LICENSE Update mit license Nov 25, 2018
README.md Release version 9.2.0 Feb 17, 2019
composer.json Bump branch alias Feb 17, 2019
phpunit.xml.dist ⬆️ phpunit/phpunit Feb 15, 2019

README.md

Instagram

instagram

An easy-to-use and simple Instagram package.

use Vinkla\Instagram\Instagram;

// Create a new instagram instance.
$instagram = new Instagram('your-access-token');

// Fetch recent user media items.
$instagram->media();

// Fetch user information.
$instagram->self();

Build Status Coverage Status Total Downloads Latest Version License

Installation

Instagram is decoupled from any library sending HTTP requests (like Guzzle), instead it uses an abstraction called HTTPlug which provides the http layer used to send requests to exchange rate services. This gives you the flexibility to choose what HTTP client and PSR-7 implementation you want to use.

Read more about the benefits of this and about what different HTTP clients you may use in the HTTPlug documentation. Below is an example using Guzzle 6:

$ composer require vinkla/instagram php-http/message php-http/guzzle6-adapter

Usage

First you need to generate an access token using Pixel Union's access token generator or by creating an Instagram application.

5937104658.5688ed0.675p84e21a0341gcb3b44b1a13d9de91

Then create a new Vinkla\Instagram\Instagram instance with your Instagram access token.

use Vinkla\Instagram\Instagram;

$instagram = new Instagram('5937104658.5688ed0.675p84e21a0341gcb3b44b1a13d9de91');

To fetch the user's recent media items you may use the media() method.

$instagram->media();

You may pass additional query parameters to the media() method if needed.

$instagram->media(['count' => 5]);

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

$instagram->self();

Note: You can only fetch a user's recent media from the given access token.

Rate Limiting

The Instagram allows you to call their API 200 times per hour. Try to cache the responses in your application.

The Instagram API uses the same rate limiting as the Graph API (200 calls per user per hour) with one exception: the /media/comments edge limits writes to 60 writes per user per hour. Please refer to the Graph API's rate limiting documentation for more information - Facebook

License

MIT © Vincent Klaiber