julionc / instagram
This package is abandoned and no longer maintained.
No replacement package was suggested.
A PHP library for the Instagram API
dev-master
2015-03-22 05:00 UTC
Requires
- php: >=5.4.0
- guzzlehttp/guzzle: ~5.2
Requires (Dev)
- phpunit/phpunit: ~4.0
This package is not auto-updated.
Last update: 2020-01-28 10:07:01 UTC
README
A PHP library for the Instagram API
Table of Contents
Installation
Using composer:
{
"require": {
"julionc/instagram": "dev-master"
}
}
How to Use
require_once('vendor/autoload.php'); $config = array( 'client_id' => 'YOUR_CLIENT_ID', 'client_secret' => 'YOUR_CLIENT_SECRET', 'redirect_uri' => 'CALLBACK_URL', 'scope' => array('basic') ); $client = new Instagram\Auth($config); // In view, get the Authorize URL $client->authorize_url();
// profile.php // Preload the settings and capture the access code (Callback step). if (!$access_token) { $client = new Instagram\Auth($config); $client->requestAccessToken($access_code); $_SESSION['access_token'] = $client->getAccessToken(); } $instagram = new \Instagram\Instagram($access_token, 'secret_key_here');
If you do not wish to put your client credentials in your code (understandable), simply set it to the environment variable instagram.client_id
and instagram.client_secrect
.
So php-instagram will automatically pick it up.
See example
folder.
EndPoints
User
$instagram = new \Instagram\Instagram($access_token); // Get basic information about a user. $user = $instagram->user->info(); // See the authenticated user's feed. $feed = $instagram->user->feed(); // Get the most recent media published by a user. $media = $instagram->user->media();