PHPackages                             jabranr/instagram-php-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. jabranr/instagram-php-sdk

ActiveFramework

jabranr/instagram-php-sdk
=========================

PHP Client for Instagram API

45857PHP

Since Apr 11Pushed 9y ago2 watchersCompare

[ Source](https://github.com/jabranr/instagram-php-sdk)[ Packagist](https://packagist.org/packages/jabranr/instagram-php-sdk)[ RSS](/packages/jabranr-instagram-php-sdk/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Instagram PHP SDK [![Build Status](https://camo.githubusercontent.com/3194263c9bb2edf23e323213fa56b75352aec876aff2f0966d6c4e7c5708365f/68747470733a2f2f7472617669732d63692e6f72672f6a616272616e722f696e7374616772616d2d7068702d73646b2e737667)](https://travis-ci.org/jabranr/instagram-php-sdk) [![Analytics](https://camo.githubusercontent.com/2ccfdd9979e5215f4b252ebbe4c188f6da2408f43e59918d6046ada6ae7410f6/68747470733a2f2f67612d626561636f6e2e61707073706f742e636f6d2f55412d35303638383835312d312f696e7374616772616d2d7068702d73646b)](https://github.com/igrigorik/ga-beacon)
=======================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#instagram-php-sdk--)

PHP client for Instagram API

> **Disclaimer:** Although this project shares same name with famous social network but is NOT an official version of PHP [SDKs for Instagram](http://github.com/Instagram). The package is provided as it is with no guarantee or promises so please use at your own risk. [Instagram](http://instagram.com) is product of Instagram/Facebook.

Install &amp; Usage
-------------------

[](#install--usage)

- Download the [latest release](https://github.com/jabranr/instagram-php-sdk/releases/) or install using [Composer](http://getcomposer.org)
- Register client at  and get `client_id`, `client_secret` and `redirect_uri`.
- Here is a basic use example:

```
require('path/to/autoload.php');

use Instagram\InstagramClient;

$config = array(
	'client_id' => 'CLIENT_ID',
	'client_secret' => 'CLIENT_SECRET',
	'redirect_uri' => 'http://example.com'
);

try {
	$ig = new InstagramClient( $config );
} catch (Exception $e) {
	echo $e->getMessage();
}

if ( isset($ig) && $ig ) {

	/**
	 * Get a new access token with OAuth
	 */

	if ( isset($_GET['code']) ) {
		$ig->get_access_token( $fresh = true, $_GET['code'] );

		print_r( $ig->get_data() );

		/**
		 * Make API requests. See various methods underneath.
		 */
	}

	/**
	 * Or display a login with Instagram link for redirect user for OAuth
	 */
	else {
		echo 'Login with Insgatram';
	}

	/**
	 * Or set an existing access token
	 */

	$ig->set_access_token( 'A_valid_access_token_obtained_previously' );

	print_r( $ig->get_data() );

	/**
	 * Make API requests. See various methods underneath.
	 */

}
```

Documentation
-------------

[](#documentation)

Use following methods to make requests to Instagram API.

#### Get Popular Media

[](#get-popular-media)

```
try	{

	$media = $ig->popularMedia( (int) $count = 25 );
	$media = json_decode( $media );
	print_r( $media );

} catch(Exception $e) {
	echo $e->getMessage();
}
```

#### Search Media

[](#search-media)

```
/**
 * Atleast lat and lng are required to make requests to this endpoint
 */

try {
	$media = $ig->searchMedia(
					(float) $lat,
					(float) $lng,
					(UNIX_TIMESTAMP) $min_timestamp,
					(UNIX_TIMESTAMP) $max_timestamp,
					(int) $distance,
					(int) $count = 25 );

	$media = json_decode( $media );
	print_r( $media );
} catch(Exception $e) {
	echo $e->getMessage();
}
```

#### Get Media using an ID

[](#get-media-using-an-id)

```
try {
	$media = $ig->getMedia( (int) $media_id );
	$media = json_decode( $media );
	print_r( $media );
} catch(Exception $e) {
	echo $e->getMessage();
}
```

License
=======

[](#license)

MIT License - © [Jabran Rafique](http://jabran.me) 2014

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/bac8f15aa523ecd5653b9eee1649ca5f00c562f2b0f84a595d58d79e409aec66?d=identicon)[jabranr](/maintainers/jabranr)

---

Top Contributors

[![jabranr](https://avatars.githubusercontent.com/u/2131246?v=4)](https://github.com/jabranr "jabranr (2 commits)")

---

Tags

instagram-apiinstagram-php-sdkphpphp-client

### Embed Badge

![Health badge](/badges/jabranr-instagram-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/jabranr-instagram-php-sdk/health.svg)](https://phpackages.com/packages/jabranr-instagram-php-sdk)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
