PHPackages                             kozz/instagram-client - 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. kozz/instagram-client

ActiveProject[API Development](/categories/api)

kozz/instagram-client
=====================

Instatram Client

1.0.0(10y ago)0209MITPHP

Since May 14Pushed 10y ago4 watchersCompare

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

READMEChangelog (5)Dependencies (7)Versions (7)Used By (0)

Instagram Client
================

[](#instagram-client)

[![Build Status](https://camo.githubusercontent.com/030a9ed25a63ffff028729b05fc9448561c708f9d04a9dc13322fe124d987312/68747470733a2f2f7472617669732d63692e6f72672f7572616b6f7a7a2f7068702d696e7374616772616d2d636c69656e742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/urakozz/php-instagram-client)[![Code Climate](https://camo.githubusercontent.com/216e5ca6d00a05df82392abc4f8b44021acfd84c5c04f70950d211483e7adec2/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f7572616b6f7a7a2f7068702d696e7374616772616d2d636c69656e742f6261646765732f6770612e737667)](https://codeclimate.com/github/urakozz/php-instagram-client)[![Test Coverage](https://camo.githubusercontent.com/4bb9d96e1205252e37de853f71c0a1da304a18684b742aaf5feb5ecba1d6e13d/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f7572616b6f7a7a2f7068702d696e7374616772616d2d636c69656e742f6261646765732f636f7665726167652e737667)](https://codeclimate.com/github/urakozz/php-instagram-client/coverage)[![SensioLabsInsight](https://camo.githubusercontent.com/4cc56e1a14201d6b34f4f082c458d1c173f23776fa3a1f88913c886cec7f12aa/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f61353335333566392d313433632d343961652d613634332d3532303535363339646231662f6d696e692e706e67)](https://insight.sensiolabs.com/projects/a53535f9-143c-49ae-a643-52055639db1f)

Install and run tests
---------------------

[](#install-and-run-tests)

```
composer install
vendor/bin/phpunit

# with coverage
vendor/bin/phpunit --coverage-html=build/logs

```

Usage
-----

[](#usage)

### OAuth

[](#oauth)

#### Step 1

[](#step-1)

```
$client = new InstagramAuth(new AuthConfig(env("I_CLIENT_ID"), env("I_CLIENT_SECRET"), "http://localhost/auth"));
$url    = $client->getOAuthUrl();

// $url === 'https://api.instagram.com/oauth/authorize/?client_id=d2cbeff4792242f7b49ea65f984a1237&response_type=code&redirect_uri=http://localhost/auth&scopes=basic
```

#### Step 2

[](#step-2)

```
$client = new InstagramAuth(new AuthConfig(env("I_CLIENT_ID"), env("I_CLIENT_SECRET"), "http://localhost/auth"));
$token  = $client->retrieveOAuthToken($_GET['code']);
```

### Subscriptions

[](#subscriptions)

#### Create Subscription

[](#create-subscription)

**Step 1**

Create public controller and action, which would handle GET request. Instagramm will call it during creating subscription:

```
class SomeController{
    function actionCallbackGet{
        echo $_GET['hub.challenge'];
    }
}
```

**Step 1**Create Subscription:

```
$client = new InstagramClientUnauthorized(new AuthConfig(env("I_CLIENT_ID"), env("I_CLIENT_SECRET"), "http://localhost/auth"));

/** @var CreateSubscriptionResponse $response */
$response = $client->call(new CreateSubscriptionRequest([
    'object' => 'user',
    'aspect' => 'media',
    'callback_url' => 'http://yoursite.me/some/callback'
]));
```

#### Get subscriptions

[](#get-subscriptions)

```
$client = new InstagramClientUnauthorized(new AuthConfig(env("I_CLIENT_ID"), env("I_CLIENT_SECRET"), "http://localhost/auth"));
/** @var GetSubscriptionsResponse $response */
$response = $client->call(new GetSubscriptionsRequest());
```

#### Delete subscription(s)

[](#delete-subscriptions)

```
$client = new InstagramClientUnauthorized(new AuthConfig(env("I_CLIENT_ID"), env("I_CLIENT_SECRET"), "http://localhost/auth"));
/** @var DeleteSubscriptionsResponse $response */
$response = $client->call(new DeleteSubscriptionsRequest([
    'object'=>'user'
]));
$response = $client->call(new DeleteSubscriptionsRequest([
    'object'=>'all'
]));
$response = $client->call(new DeleteSubscriptionsRequest([
    'id'=>1
]));
```

#### Handle subscription request from the Instagram

[](#handle-subscription-request-from-the-instagram)

```
$config  = new AuthConfig(env("I_CLIENT_ID"), env("I_CLIENT_SECRET"), "http://localhost/auth");
$reactor = new SubscriptionReactor($config);
$reactor->registerCallback("user", function(RealTimeSubscription $subscription){
    // Do something
});

$reactor->process($this->json, $_SERVER['HTTP_X_HUB_SIGNATURE']);
// $_SERVER['HTTP_X_HUB_SIGNATURE'] - it is just header "X-Hub-Signature"
```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 70.3% 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.

###  Release Activity

Cadence

Every ~15 days

Total

5

Last Release

3959d ago

Major Versions

0.0.4 → 1.0.02015-07-17

### Community

Maintainers

![](https://www.gravatar.com/avatar/8f78e5a1e5128b31ba7dfedcc9a3ccfbc4852f5df1b79a54867aa377169968a1?d=identicon)[urakozz](/maintainers/urakozz)

---

Top Contributors

[![urakozz](https://avatars.githubusercontent.com/u/5797393?v=4)](https://github.com/urakozz "urakozz (26 commits)")[![TzepART2](https://avatars.githubusercontent.com/u/11412314?v=4)](https://github.com/TzepART2 "TzepART2 (8 commits)")[![tzepart](https://avatars.githubusercontent.com/u/10636031?v=4)](https://github.com/tzepart "tzepart (3 commits)")

---

Tags

clientinstagram

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[openai-php/laravel

OpenAI PHP for Laravel is a supercharged PHP API client that allows you to interact with the Open AI API

3.7k7.6M74](/packages/openai-php-laravel)[facebook/php-business-sdk

PHP SDK for Facebook Business

90821.9M34](/packages/facebook-php-business-sdk)[facebook/php-ads-sdk

PHP SDK for Facebook Business

9014.1M8](/packages/facebook-php-ads-sdk)[resend/resend-php

Resend PHP library.

574.7M21](/packages/resend-resend-php)[crowdin/crowdin-api-client

PHP client library for Crowdin API v2

611.5M5](/packages/crowdin-crowdin-api-client)[mozex/anthropic-laravel

Anthropic PHP for Laravel is a supercharged PHP API client that allows you to interact with the Anthropic API

71226.4k1](/packages/mozex-anthropic-laravel)

PHPackages © 2026

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