PHPackages                             webmakersteve/instagram - 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. [API Development](/categories/api)
4. /
5. webmakersteve/instagram

ActiveLibrary[API Development](/categories/api)

webmakersteve/instagram
=======================

Library for interacting with the Instagram API

1161PHP

Since Jan 27Pushed 10y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Instagram PHP [![Build Status](https://camo.githubusercontent.com/7bab4cba0ebe8279932f8f00611c911f97ab58a485f0cf750be78f4cef810239/68747470733a2f2f7472617669732d63692e6f72672f7765626d616b657273746576652f696e7374616772616d2d7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/webmakersteve/instagram-php) [![Latest Stable Version](https://camo.githubusercontent.com/2fcdff9887dd0c339a1256ebb3791dab086270b62f32314b61ae592917f5a309/68747470733a2f2f706f7365722e707567782e6f72672f7765626d616b657273746576652f696e7374616772616d2f76657273696f6e)](https://packagist.org/packages/webmakersteve/instagram) [![Total Downloads](https://camo.githubusercontent.com/b7211877bd6b65d7fbda6d1365dde15209759b1d14f9d31f72ed4e3cdb60026f/68747470733a2f2f706f7365722e707567782e6f72672f7765626d616b657273746576652f696e7374616772616d2f646f776e6c6f616473)](https://packagist.org/packages/webmakersteve/instagram)
======================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#instagram-php---)

Yet another Instagram library. The old one I depended on became outdated so I began the process of rewriting it.

Contributing
------------

[](#contributing)

So far it has the user endpoints. Happy to take any pull requests. Adding new endpoints is super easy. Take a look at the code for one:

```
public function getUserMedia($id = 'self', $limit = null, $min = false, $max = false) {
  return $this->doRequest('users/:id/media/recent', self::METHOD_GET, [
    'count' => $this->getLimitSize($limit),
    'id' => $id,
    'min_id' => $min,
    'max_id' => $max
  ]);
}
```

That's right. As of `1/5` the route declarations even support PARAMETER REPLACEMENT. Any parameters found in the route will be stripped from the rest of the request building. It also strips falsy parameters so you can write less logic. It does strict testing, that is, `===`.

WOAH. So, feel free to pull request with more methods of the API. I am trying to make parameters for the endpoint parameters for the function. I know there may be situations where it doesn't make sense to have so many parameters. In situations where there are a **lot** of optional parameters, I will likely be making an associative array to deal with that.

Installation
------------

[](#installation)

```
curl -s http://getcomposer.org/installer | php
php composer.phar require webmakersteve/instagram

```

Example
-------

[](#example)

Well, anyway - typical OAuth API flow

```
$instagram = new Webmakersteve\Instagram\Client([
  'client_id' => 'KINDA SECRET',
  'client_secret' => 'ACTUALLY SECRET',
  'redirect_uri' => 'http://yourapp.com' // This is necessary to use the OAuth flow.
]);
```

When we have our beautiful client the API allows you to do public methods. There used to be more, but now it seems only the OAuth transactions are "public"

```
// Redirect them to the login url
$instagram->getLoginUrl(['basic', 'public_content']); // You can add additional scopes in here like this

// And when they return...

$code = $_GET['code'];
$token = $instagram->getOAuthToken($code, true); // True param means don't return the rest of the data

$instagram->setAccessToken($token); // Now we have access to special endpoints

var_dump($instagram->getUser()); // Should return the user information
```

Simple is that. Of course, you need to store the access token somewhere and shove it in there so they don't need to authorize individual requests. But that's up to whatever app infrastructure you're using.

All API endpoints, or the `doRequest` method more importantly, return `Response` classes. These nifty little loaders take Response objects and convert them into something a bit more easy to work with for a lot of situations.

Firstly, they can be used like `stdClass`es, so if you just want to do it that way go ahead. If there was JSON data they will automatically decode it. If the Data wasn't JSON, accessing it like an object will just return `false`. So, no nasty PHP errors.

You also get a little abstraction for those situations where you need to access nested properties. Naturally, if the first thing returned null and you try to chain something it is going to error. I know APIs get messy sometimes, so I made a `getProperty` function. This is the way I would recommend interacting with it.

Instead of `$data->username` you would do `$data->getProperty('username')`. If the property exists, you'll get it. If not, it will return the default, which is `''`. You can set your own default as the second parameter.

In even brighter news, you can do this in the case of nested properties. `$data->getProperty('user.name.first_name')` If the property is there you'll get it. This doesn't support any array indexing or anything yet, so you'll need to deal with that yourself, but I felt that isn't as large a problem.

There are a few exception classes. There is some Instagram-sourced data in them. It doesn't just blindly shove the JSON into the message - it tries to actually parse it out and give pertinent information. So, enjoy that.

Let me know what you think. Stars are great. Pull requests are better.

Moar docs
---------

[](#moar-docs)

Going through the actual code is pretty easy, and makes it pretty easy to see what's going on. But in case that isn't for you just check out [the documentation](http://webmakersteve.github.io/instagram-php)

License
-------

[](#license)

Licensed under the MIT license. Copy enclosed in repo.

:)

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community8

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://avatars.githubusercontent.com/u/6353085?v=4)[Stephen Parente](/maintainers/webmakersteve)[@webmakersteve](https://github.com/webmakersteve)

---

Top Contributors

[![borantula](https://avatars.githubusercontent.com/u/1006583?v=4)](https://github.com/borantula "borantula (1 commits)")

### Embed Badge

![Health badge](/badges/webmakersteve-instagram/health.svg)

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

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

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