PHPackages                             alpanayotov/instagram-helper - 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. alpanayotov/instagram-helper

ActiveLibrary[API Development](/categories/api)

alpanayotov/instagram-helper
============================

WordPress based library for retrieving and saving data from Instragram

1.1(10y ago)630[3 issues](https://github.com/alpanayotov/instagram-helper/issues)MITPHP

Since Feb 9Pushed 8y agoCompare

[ Source](https://github.com/alpanayotov/instagram-helper)[ Packagist](https://packagist.org/packages/alpanayotov/instagram-helper)[ Docs](https://github.com/alpanayotov/instagram-helper)[ RSS](/packages/alpanayotov-instagram-helper/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (3)DependenciesVersions (8)Used By (0)

*This project is not maintained at the moment.*
===============================================

[](#this-project-is-not-maintained-at-the-moment)

---

Instagram Helper
================

[](#instagram-helper)

##### WordPress based library for retrieving and saving data from Instragram.

[](#wordpress-based-library-for-retrieving-and-saving-data-from-instragram)

#### Requirements:

[](#requirements)

- PHP 5 &gt;= 5.3.0
- WordPress
- Instagram Client Secret and Client Id :)

##### Important!

[](#important)

If Instagram does not return anything after proper configuration of the code, please read this --

#### Capabilities:

[](#capabilities)

- Fetch user feed by username.
- Fetch Instagram posts by hashtag.
- Save the data in a custom post type ( on demand ).

#### How To Use:

[](#how-to-use)

Include the `instagram-helper.php` file in your functions.php. At this point, you need to create a `$client` using the `Factory` class. The `$client` takes care of the authentication process:
`$client  = Instagram_Helper\Factory::create( 'client', $configuration );`

The `$configuration` array should look like this:

```
$configuration = array(
    'user_name'     => 'instagram_user_name',
    'client_id'     => 'instagram_client_id',
    'client_secret' => 'instagram_client_secret',
`);

```

The `$client` object has the following methods:

- `get_redirect_uri()` -- Returns the redirection URL that should be placed in the Instagram Client `Valid redirect URIs` field.
- `generate_authentication_url()` -- Returns the URL that should be visited in order to start the authentication process.
- `get_access_token()` -- Handles the retrieval of the access token. Should not be used directly.

Once the authentication is completed, you can pull posts from Instagram. To do so, you need to create a `$data_manager` object, using the `Factory`.

`$data_manager  = Instagram_Helper\Factory::create( 'data_manager', $manager_config );`

The `$manager_config` array is optional. It may, however, contain the `limit` for the request -- `$manager_config = array( 'limit' => 5 ) `. This will force default limit of 5 entries for all queries.

The `$data_manager` has the following methods:

- `fetch_user_feed( array( 'limit'  => 5 ) )` -- Fetches the last 5 posts from the feed of the user, used in the configuration of the `$client`.
- `fetch_hashtag_feed( array( 'limit'  => 5, 'hashtag' => 'tag' ) )` -- Fetches the last 5 posts with that hashtag
- `get_feed_data()` -- Returns the data fetched by the `fetch_user_feed` or `fetch_hashtag_feed` methods.
- `clear_feed_data()` -- Delete the data fetched by the `fetch_user_feed` or `fetch_hashtag_feed` methods
- `flush_cache()` -- Deletes the data transients ( by default, the data is stored in transients ).
- `get_transient_lifetime()` -- Return the lifetime of the used transients.
- `set_transient_lifetime()` -- Sets the lifetime of the transients ( this defaults to 300 seconds ).

---

#### Example:

[](#example)

```
$client_config = array(
    'user_name'     => 'instagram_user_name',
    'client_id'     => 'instagram_client_id',
    'client_secret' => 'instagram_client_secret',
);

$client  = Instagram_Helper\Factory::create( 'client', $client_config );
$data_manager  = Instagram_Helper\Factory::create( 'data_manager', array( 'limit' => 5 ) );

$data_manager->fetch_user_feed();
$feed = $data_manager->get_feed_data(); //the data from instagram in now available in $feed

```

---

#### Additional Capabilities:

[](#additional-capabilities)

##### Posts Storage

[](#posts-storage)

Sometimes, you would need to save the data from Instagram for later. In order to do this, you can use a `posts_store` obejct and it's `save()` method.

```
$storer = Instagram_Helper\Factory::create( 'posts_store', array( 'update_count' => 2 ) );
$storer->save( $feed );

```

The `update_count` specifies how many posts, of the already existing posts, should be updated with new information from Instagram ( this one is still work in progress :) )

##### Carbon Fields Integration

[](#carbon-fields-integration)

If you are using the `Carbon Fields` library, you can take advantage of the `Carbon_Helper.php` class. It must be used in conjunction with the `$client` object.

```
$client  = Instagram_Helper\Factory::create( 'client', array( 'enable_carbon_support' => true ) );
$carbon_helper = Instagram_Helper\Factory::create( 'carbon_helper', $client );
$carbon_helper->create_options_page();

```

The `create_options_page()` method creates a page in the back end, containing fields for all the information needed by the `$client`. The `$client` fetches this information on its own, you do not need to do anything.

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity68

Established project with proven stability

 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.

###  Release Activity

Cadence

Every ~31 days

Total

3

Last Release

3732d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/42336382?v=4)[Alexander Panayotov](/maintainers/alpanayotov)[@alpanayotov](https://github.com/alpanayotov)

---

Top Contributors

[![alpanayotov](https://avatars.githubusercontent.com/u/42336382?v=4)](https://github.com/alpanayotov "alpanayotov (35 commits)")

---

Tags

clientwordpressinstagramfeed

### Embed Badge

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

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

###  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.

943664.4k5](/packages/pgrimaud-instagram-user-feed)[hieu-le/wordpress-xmlrpc-client

A PHP client for Wordpress websites that closely implement the XML-RPC WordPress API with full test suite built in

116161.2k2](/packages/hieu-le-wordpress-xmlrpc-client)[sybrew/the-seo-framework

An automated, advanced, accessible, unbranded and extremely fast SEO solution for any WordPress website.

47882.8k](/packages/sybrew-the-seo-framework)[yizack/instagram-feed

PHP library to retrieve an Instagram profile feed, embed the feed of your authorized Instagram accounts on your website. The library uses the Instagram API with auto-refreshing access token support.

1215.9k3](/packages/yizack-instagram-feed)

PHPackages © 2026

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