PHPackages                             samsonos/php\_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. samsonos/php\_instagram

ActiveLibrary

samsonos/php\_instagram
=======================

SamsonPHP Instagram module

0.1.0(10y ago)21352Open Software License (OSL) v 3.0PHP

Since Dec 5Pushed 9y ago3 watchersCompare

[ Source](https://github.com/samsonos/php_instagram)[ Packagist](https://packagist.org/packages/samsonos/php_instagram)[ Docs](http://samsonphp.com/)[ RSS](/packages/samsonos-php-instagram/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (4)Versions (3)Used By (0)

SamsonPHP Instagram API module
==============================

[](#samsonphp-instagram-api-module)

[![Latest Stable Version](https://camo.githubusercontent.com/aa3e0dae833c849006a7648be07523b20dbdc1175316bbed75c30ed4a8ae92f4/68747470733a2f2f706f7365722e707567782e6f72672f73616d736f6e6f732f7068705f696e7374616772616d2f762f737461626c652e737667)](https://packagist.org/packages/samsonos/php_instagram)[![Build Status](https://camo.githubusercontent.com/63a3c917f6735c0d4b62dff173416c8919049ca3f9542a084b6f6cd773655e36/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f73616d736f6e6f732f7068705f696e7374616772616d2f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/samsonos/php_instagram/badges/build.png?b=master)[![Code Coverage](https://camo.githubusercontent.com/9f5999ec83d5433503d019320cb43f8dd4e10ada7b90fb29db6cb5c76e255616/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f73616d736f6e6f732f7068705f696e7374616772616d2f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/samsonos/php_instagram/?branch=master)[![Total Downloads](https://camo.githubusercontent.com/039d94075622787ff2cdb5e38ff8a0438479c2254e6b21dde0de74ca956823bd/68747470733a2f2f706f7365722e707567782e6f72672f73616d736f6e6f732f7068705f696e7374616772616d2f646f776e6c6f6164732e737667)](https://packagist.org/packages/samsonos/php_instagram)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/1247a21091580d9f4814aa73e5e743d20b5f6f169f8d1c4ccc00e7575473436d/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f73616d736f6e6f732f7068705f696e7374616772616d2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/samsonos/php_instagram/?branch=master)[![Stories in Ready](https://camo.githubusercontent.com/f454ae2d574593aff435383df08c132c4fcdee8bd79a2a06f7e198c733d96a8f/68747470733a2f2f62616467652e776166666c652e696f2f73616d736f6e6f732f7068705f696e7374616772616d2e706e673f6c6162656c3d7265616479267469746c653d5265616479)](https://waffle.io/samsonos/php_instagram)

Configuration
-------------

[](#configuration)

First of all you need to create configuration class which is working thanks to [SamsonPHP module/service configuration](https://github.com/samsonphp/config):

```
class InstagramConfig extends \samsonphp\config\Entity
{
    public $appId = 'YOUR_CLIENT_ID';

    public $appSecret = 'YOUR_CLIENT_SECRET';
}
```

Get list of posts by tag
------------------------

[](#get-list-of-posts-by-tag)

After creating configuration you can using module methods. First method uses Instagram [Tag Endpoints](https://www.instagram.com/developer/endpoints/tags/) API. Used method is `listByTag($tag, $params = array())`. Here the second parameter defines your request parameters (count, max\_tag\_id, min\_tag\_id).

For example you want to get 10 posts by hashtag `adventure`:

```
/** @var \samson\instagram\Instagram $instagram Get SamsonPHP Instagram module */
$instagram = m('instagram');

// Define tag
$myTag = 'adventure';

// Get list of posts
$posts = $instagram->listByTag($myTag, array('count' => 10));
```

Like post
---------

[](#like-post)

This method uses Instagram [Like Endpoints](https://www.instagram.com/developer/endpoints/likes/) API. For using it you just need to know users access token for your application, and media identifier. Notice, that this method can toggle like status, so if you create this request for already liked media, this media will unliked.

Simple example:

```
/** @var \samson\instagram\Instagram $instagram Get SamsonPHP Instagram module */
$instagram = m('instagram');

// Define media to like
$myMediaID = '657988443280050001_25025320';

// Get list of posts
$posts = $instagram->likeMedia($myMediaID, 'ACCESS_TOKEN');
```

Relationships
-------------

[](#relationships)

This method uses Instagram [Relationship Endpoints](https://www.instagram.com/developer/endpoints/relationships/) API. You can user relationships using method `setUserRelationship($user_id, $access_token, $action = 'follow')`. For using this method you need to know user instagram identifier and his access token. The third parameter defines the relationship.

Simple example:

```
/** @var \samson\instagram\Instagram $instagram Get SamsonPHP Instagram module */
$instagram = m('instagram');

// Define media to like
$user_id = '12345678';

// Get list of posts
$posts = $instagram->setUserRelationship($user_id, 'ACCESS_TOKEN', 'unfollow');
```

Subscriptions
-------------

[](#subscriptions)

This method uses Instagram [User Subscriptions](https://www.instagram.com/developer/subscriptions/) API. You are able to create subscriptions for updates of your authenticated users. Use method `subscribe($object, $aspect, $verify_token, $callback, $object_id = null)` for creating it. Read more about the parameters in instagram API \[documentation\] ()

Simple example:

```
/** @var \samson\instagram\Instagram $instagram Get SamsonPHP Instagram module */
$instagram = m('instagram');

// Get list of posts
$posts = $instagram->subscribe('user', 'media', 'VERIFY_TOKEN', 'callback-function');
```

This module is working using [Instagram API](https://www.instagram.com/developer/)

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 56.7% 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 ~66 days

Total

2

Last Release

3751d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0be8756efdc8f599b8fe9261bed31570d0f140a3b921f0f891877a9133ad654c?d=identicon)[samsonos](/maintainers/samsonos)

---

Top Contributors

[![vitalyiegorov](https://avatars.githubusercontent.com/u/586558?v=4)](https://github.com/vitalyiegorov "vitalyiegorov (34 commits)")[![onysko](https://avatars.githubusercontent.com/u/7703953?v=4)](https://github.com/onysko "onysko (17 commits)")[![nik-os](https://avatars.githubusercontent.com/u/7326967?v=4)](https://github.com/nik-os "nik-os (7 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (2 commits)")

---

Tags

phpinstagramsamsonphpsamsonos

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[pgrimaud/instagram-user-feed

This is a scraper to easily fetch any feed and interact with Instagram (like, follow, etc.) without OAuth for PHP.

940657.1k5](/packages/pgrimaud-instagram-user-feed)[jstolpe/instagram-graph-api-php-sdk

Instagram Graph API PHP SDK

13998.4k2](/packages/jstolpe-instagram-graph-api-php-sdk)[edbizarro/laravel-facebook-ads

Facebook &amp; Instagram Ads for Laravel 5.6+

13629.5k](/packages/edbizarro-laravel-facebook-ads)[smochin/instagram-php-crawler

A simple PHP Crawler for Instagram

459.8k](/packages/smochin-instagram-php-crawler)

PHPackages © 2026

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