niyazialpay / instagram
PHP package for Instagram API. With this PHP package, you can view user media using the Instagram API.
Installs: 155
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/niyazialpay/instagram
Requires
- php: ^8.0
- ext-json: *
- guzzlehttp/guzzle: ^7.0.1
This package is auto-updated.
Last update: 2025-10-05 01:07:33 UTC
README
About
PHP package for Instagram API. With this PHP package, you can view user media using the Instagram API.
Requirements
- PHP 8.0 or higher
- Guzzle
- Registered Instagram App
Initialize the class
<?php require_once 'Instagram.php'; use niyazialpay\Instagram; $instagram = new Instagram(array( 'apiKey' => 'YOUR_APP_KEY', 'apiSecret' => 'YOUR_APP_SECRET', 'apiCallback' => 'YOUR_APP_CALLBACK' )); echo "<a href='{$instagram->getLoginUrl()}'>Login with Instagram</a>"; ?>
Authenticate user (OAuth2)
<?php $code = $_GET['code']; $data = $instagram->getOAuthToken($code); echo 'Your username is: ' . $data->user->username; ?>
Long Lived Token
<?php $code = $_GET['code']; $long_lived_token = $instagram::getLongLivedToken($_GET['code']); ?>
Refresh Long Lived Token
<?php $long_lived_token = $instagram::RefreshToken('Old long lived token will be added here before expiration'); ?>