PHPackages                             stubenbaines/instagramphpapi - 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. stubenbaines/instagramphpapi

ActiveLibrary[API Development](/categories/api)

stubenbaines/instagramphpapi
============================

Library to interact with the Instagram API.

00PHP

Since Mar 24Pushed 12y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

instagramPhpApi
===============

[](#instagramphpapi)

A PHP Library to make calls to the Instagram API.

Requires
--------

[](#requires)

- php version &gt;= 5.3
- cURL extension

Usage
-----

[](#usage)

See Instagram API docs for an overview of how to use the Instagram API and the available endpoints:

The library supports both authenticated calls via an access token and non-auth calls using just a client id.

Non-authenticated Calls
-----------------------

[](#non-authenticated-calls)

Many calls to Instagram can be made without an authenticated user. For these calls, just a client id is required. Go to  to generate a new client id.

Once you have a client id, you can create an instance of the Instaram api object passing in just a client id.

```
$client_id = '[YOUR CLIENT ID]';
$instagram = new Instagram($client_id);
// Now execute an api call to grab popular media and store the response.
$res = $instagram->get('/media/popular');
var_dump($res);
```

Authenticated Calls
-------------------

[](#authenticated-calls)

Making calls as an authenticated user is more complicated in that you need to have the user authorize your application which then gives you an access code which is then sent to Instagram to generate an access code used for all api requests.

```
$client_id = '[YOUR CLIENT ID]';
$redirect = '[URL OF YOUR APP THAT HANDLES ACCESS CODES]';

$instagram = new Instagram($client_id, $client_secret, $redirect);

// Get an authorize URL. User will be asked to give your app permission to their Instagram account and redirect back with access code.
$instagram->getAuthUrl();

// Now take the access code and request an access token.
$instagram->getAccessToken($code);

// Once you have the access token, you can request user info.
$user = $instagram->getUser();

// Or make authenticated api requests.
$res = $instagram->get('/media/popular');
```

Samples
-------

[](#samples)

In the repo there is a file named demo.php which demonstrates some non-authenticated calls. demo\_auth.php shows some authenticated calls. Replace the client\_id with your client ID before running.

License
-------

[](#license)

Released under the MIT license.

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community7

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/0574ff0ffe2fb7800711867ca6a0988aa20d3e20e05f0af0c4f10c21f7e06c3d?d=identicon)[stubenbaines](/maintainers/stubenbaines)

---

Top Contributors

[![stubenbaines](https://avatars.githubusercontent.com/u/425089?v=4)](https://github.com/stubenbaines "stubenbaines (10 commits)")

### Embed Badge

![Health badge](/badges/stubenbaines-instagramphpapi/health.svg)

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

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

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

A PHP wrapper for Twilio's API

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

GitHub API v3 client

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

PHP SDK for Facebook Business

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

The Microsoft Graph SDK for PHP

65723.5M95](/packages/microsoft-microsoft-graph)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)

PHPackages © 2026

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