PHPackages                             nixondesign/craft-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. nixondesign/craft-instagram

AbandonedArchivedCraft-plugin[API Development](/categories/api)

nixondesign/craft-instagram
===========================

Instagram Basic API integration for Craft CMS

v2.0.0(3y ago)06121MITPHP

Since Jul 28Pushed 3y agoCompare

[ Source](https://github.com/nixondesign/craft-instagram)[ Packagist](https://packagist.org/packages/nixondesign/craft-instagram)[ RSS](/packages/nixondesign-craft-instagram/feed)WikiDiscussions master Synced today

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

Instagram
=========

[](#instagram)

This plugin provides easy access to the [Instagram Basic Display API](https://developers.facebook.com/docs/instagram-basic-display-api) for [Craft CMS](https://craftcms.com/).

**Features:**

- Twig &amp; JSON: Feeds are accessible both in Twig and as JSON via action urls.
- Multisite support: Apps are authenticated per site allowing per site media feeds.
- Easy token management: Tokens can easily be refreshed via the control panel or CLI.

Authorising Instagram
---------------------

[](#authorising-instagram)

Before you can authorise the plugin you must first set up a Facebook app, this is the app you'll be using to authorise users and make API calls. Once set up you will require the App ID and App Secret. To set up your app, follow steps 1 to 3 in the [offical getting started guide](https://developers.facebook.com/docs/instagram-basic-display-api/getting-started). When asked for your "Valid OAuth Redirect URIs", use the URL found in the plugin settings page. If using multisite you'll need to create test users for each account you want to authorise.

### Plugin Setup

[](#plugin-setup)

1. First either make sure you are logged into the Instgram account you want to authenticate or are logged out completely.
2. Navigate to the plugin settings page, if running Craft multisite switch to the appropriate site.
3. Enter the App ID and App Secret, found under App Dashboard &gt; Products &gt; Instagram &gt; Basic Display. These can be set to environment variables.
4. Click "Authenticate" where you'll be taken to Instagram to authorise the plugin. Once authorised you will be redirected back to the plugin page.

### Refreshing Access Tokens

[](#refreshing-access-tokens)

This plugin uses [long-lived access tokens](https://developers.facebook.com/docs/instagram-basic-display-api/guides/long-lived-access-tokens) which are valid for 60 days. These tokens can be refreshed to increase their life by another 60 days using the `instagram/tokens/refresh` CLI command. This command could be run periodically via cron.

```
0 0 1 * * /craft instagram/tokens/refresh

```

Tokens can also be refreshed via the control panel.

Displaying a users media
------------------------

[](#displaying-a-users-media)

Fetching the users can be handled in two ways, via Twig or using JSON returned from an action URL.

### Twig

[](#twig)

A users media can be displayed using the `getMedia()` method. This method accepts an optional [options](#options) parameter.

```
{% set feed = craft.instagram.getMedia({
  limit: 20
}) %}

{% if feed %}
  {% for media in feed.media %}
    {{ media.getImg() }}
  {% endfor %}
{% endif %}
```

#### Media Object

[](#media-object)

PropertyDescriptionidID.captionCaption text. Not returnable for Media in albumsusernameOwner's usernametimestampPublish datepermalinkPermanent URLmediaUrlURLmediaTypeType of media. Can be IMAGE, VIDEO, or CAROUSEL\_ALBUMthumbnailUrlthumbnail image URL. Only available on video MediagetUrl()Either the mediaUrl or thumbnailUrl depending on media typegetImg()Returns an image element#### Paging

[](#paging)

In addition to the `media` property, `getMedia` also returns `before` and `after` properties for [pagination](#pagination).

### JSON

[](#json)

The media feed is available as JSON via the `instagram/media/fetch` action URL. [Options](#options) can be passed as query parameters.

```
instagram/media/fetch?limit=1

```

```
{
  "media": [
    {
      "id": "",
      "caption": "",
      "username": "",
      "timestamp": "",
      "permalink": "",
      "mediaUrl": "",
      "mediaType": "",
      "thumbnailUrl": ""
    }
  ],
  "before": "",
  "after": ""
}
```

### Pagination

[](#pagination)

Pagination can be implemented by using the `before` and `after` properties sent along with the `media` property.

```
{
  "media": [],
  "before": "",
  "after": ""
}
```

These can be then sent as options with the next request.

**Twig**

```
craft.instagram.getMedia({
  after: "xxxxxxxxxxxxxxxxxxx"
})
```

**Action URL**

```
instagram/media/fetch?after=xxxxxxxxxxxxxxxxxxx

```

### Options

[](#options)

Both the Twig Variable and JSON endpoint accept the following options:

OptionDescriptionDefaultafterUnique marker which to fetch media afternullbeforeUnique marker which to fetch media beforenullcacheThe duration to cache data for in seconds, set to false for no caching300limitThe number of media items to fetch, if null uses Instagram's defaultnull

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 80.8% 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 ~266 days

Total

4

Last Release

1312d ago

Major Versions

v1.1.1 → v2.0.02022-10-06

### Community

Maintainers

![](https://www.gravatar.com/avatar/a758c33c6260c0bcdb838d1c3a2f34cb31c64c851d63e06023c8abe26b04f95e?d=identicon)[nixondesign](/maintainers/nixondesign)

---

Top Contributors

[![rynpsc](https://avatars.githubusercontent.com/u/5955881?v=4)](https://github.com/rynpsc "rynpsc (21 commits)")[![helenatnixon](https://avatars.githubusercontent.com/u/100776039?v=4)](https://github.com/helenatnixon "helenatnixon (3 commits)")[![nixondesigndev](https://avatars.githubusercontent.com/u/17004710?v=4)](https://github.com/nixondesigndev "nixondesigndev (1 commits)")[![ryssbowh](https://avatars.githubusercontent.com/u/6736613?v=4)](https://github.com/ryssbowh "ryssbowh (1 commits)")

---

Tags

craft-plugincraftcmsinstagraminstagramcmsyii2craftcms

### Embed Badge

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

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

###  Alternatives

[craftcms/element-api

Create a JSON API for your elements in Craft

503701.3k8](/packages/craftcms-element-api)[wrav/oembed

A simple plugin to extract media information from websites, like youtube videos, twitter statuses or blog articles.

36205.0k3](/packages/wrav-oembed)[craftcms/commerce

Craft Commerce

243416.9k153](/packages/craftcms-commerce)[craftcms/apple-news

Publish Craft CMS entries to Apple News

4223.5k](/packages/craftcms-apple-news)[scaramangagency/craftagram

Grab Instagram content through the Instagram API

1426.0k](/packages/scaramangagency-craftagram)[craftpulse/craft-typesense

Craft Plugin that synchronises with Typesense

122.7k](/packages/craftpulse-craft-typesense)

PHPackages © 2026

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