PHPackages                             melvilleco/instagram-basic-display - 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. melvilleco/instagram-basic-display

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

melvilleco/instagram-basic-display
==================================

Provides endpoints and helper console commands that make it easier to work with the Instagram Basic Display API.

1.0.6(4y ago)51.0k[1 issues](https://github.com/jonathanmelville/craft-instagram-basic-display/issues)MITPHP

Since Apr 27Pushed 4y ago1 watchersCompare

[ Source](https://github.com/jonathanmelville/craft-instagram-basic-display)[ Packagist](https://packagist.org/packages/melvilleco/instagram-basic-display)[ RSS](/packages/melvilleco-instagram-basic-display/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (2)Versions (7)Used By (0)

Instagram Basic Display plugin for Craft CMS 3.x
================================================

[](#instagram-basic-display-plugin-for-craft-cms-3x)

This plugin creates endpoints in your Craft install for you to consume the Instagram Basic Display API as well as the oEmbed API. It also provides some helper methods for dealing with your access token and getting refresh tokens.

[![](https://raw.githubusercontent.com/jonathanmelville/craft-instagram-basic-display/master/resources/img/plugin-logo.png)](https://raw.githubusercontent.com/jonathanmelville/craft-instagram-basic-display/master/resources/img/plugin-logo.png)

Requirements
------------

[](#requirements)

This plugin requires Craft CMS 3.0.0-beta.23 or later.

Installation
------------

[](#installation)

To install the plugin, follow these instructions.

1. Open your terminal and go to your Craft project:

    ```
     cd /path/to/project

    ```
2. Then tell Composer to load the plugin:

    ```
     composer require melvilleco/instagram-basic-display

    ```
3. Obtain a [long-lived access token](https://developers.facebook.com/docs/instagram-basic-display-api/guides/long-lived-access-tokens/) from Instagram (see example video below) and [insert it into your database](#inserting-your-access-token).

[](https://www.loom.com/share/b050f13355a34a9c825c47d85e122767)

How to get an initial access token for the Instagram Basic Display API - Watch Video

[![](https://camo.githubusercontent.com/f552a94e3686f494cf7f6cedacbf2fb75b17d669a91740c2d1049f9fcabe9a06/68747470733a2f2f63646e2e6c6f6f6d2e636f6d2f73657373696f6e732f7468756d626e61696c732f36383763633435363735396434666238393737323037356237376366363465312d776974682d706c61792e676966)](https://camo.githubusercontent.com/f552a94e3686f494cf7f6cedacbf2fb75b17d669a91740c2d1049f9fcabe9a06/68747470733a2f2f63646e2e6c6f6f6d2e636f6d2f73657373696f6e732f7468756d626e61696c732f36383763633435363735396434666238393737323037356237376366363465312d776974682d706c61792e676966)

Instagram Basic Display Overview
--------------------------------

[](#instagram-basic-display-overview)

This plugin provides some helper methods and endpoints for working with the [Instagram Basic Display API](https://developers.facebook.com/docs/instagram-basic-display-api/) and the [Instagram OEmbed](https://developers.facebook.com/docs/instagram/oembed) service.

The plugin makes available several useful console commands and controller actions to help you access your Instagram content.

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

[](#configuration)

Configuration is done via the `src/config.php` config file. It should be renamed to `instagram-basic-display.php` and copied to your `config/` directory to take effect.

The most likely options you may want to change are `cache_duration` and `fields`. `fields` simply determines [what data is returned](https://developers.facebook.com/docs/instagram-basic-display-api/reference/media/#fields) by the request.

Inserting Your Access Token
---------------------------

[](#inserting-your-access-token)

By default, Instagram User Access Tokens are short-lived and are valid for one hour. However, short-lived tokens can be exchanged for long-lived tokens.

Long-lived tokens are valid for 60 days and can be refreshed as long as they are at least 24 hours old but have not expired, and the app user has granted your app the `instagram_graph_user_profile` permission.

After you obtain your long-lived token, run the following command to insert it into your database:

```
  ./craft instagram-basic-display/token/insert [YOUR_TOKEN_HERE]

```

Refreshing Your Token
---------------------

[](#refreshing-your-token)

As long-lived tokens are only valid for 60 days, you will need to periodically request a refreshed token. You can easily do this by setting up a cron task that calls the refresh method of the plugin:

```
  ./craft instagram-basic-display/token/refresh

```

Your old token will be used to obtain a new one, and the new token will be inserted into the database.

Commands and Endpoints
----------------------

[](#commands-and-endpoints)

### Console Commands

[](#console-commands)

The following console commands are available:

---

Get the expiration date/time of the current token:

```
  ./craft instagram-basic-display/token/exp

```

---

Echo out the current access token:

```
  ./craft instagram-basic-display/token/get

```

---

Manually insert an access token into the database:

```
  ./craft instagram-basic-display/token/insert

```

---

Refresh the current token:

```
  ./craft instagram-basic-display/token/refresh

```

---

### Accessing your Instagram feed as JSON

[](#accessing-your-instagram-feed-as-json)

If accessing your feed from inside a Vue or React component, you can hit the following endpoint to get a JSON response:

```
  /actions/instagram-basic-display/feed/get

```

### Getting Your Feed in Twig

[](#getting-your-feed-in-twig)

You can also output your feed inside your Twig templates using a `{% for %}` loop:

```

   {% for media in craft.instagram.getFeed() %}
      {% if media.media_type == 'IMAGE' %}

      {% endif %}
   {% endfor %}

```

Instagram Basic Display Roadmap
-------------------------------

[](#instagram-basic-display-roadmap)

Some things to do, and ideas for potential features:

- Add OEmbed docs.
- Create better docs for how to get an initial token.
- Work out solution for scaling images.

Brought to you by [Jonathan Melville](https://codemdd.io)

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

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.

###  Release Activity

Cadence

Every ~5 days

Total

5

Last Release

1824d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7415693?v=4)[Jonathan Melville](/maintainers/jonathanmelville)[@jonathanmelville](https://github.com/jonathanmelville)

---

Top Contributors

[![jonathanmelville](https://avatars.githubusercontent.com/u/7415693?v=4)](https://github.com/jonathanmelville "jonathanmelville (38 commits)")

---

Tags

craftcraft-plugincraft3craftcmsinstagraminstagram-apiinstagram-basic-display-apiinstagram-oembedinstagramcmsCraftcraftcmscraft-plugininstagram apiinstagram feedinstagram oembedinstagram embedcraft instagraminstagram basic display

### Embed Badge

![Health badge](/badges/melvilleco-instagram-basic-display/health.svg)

```
[![Health](https://phpackages.com/badges/melvilleco-instagram-basic-display/health.svg)](https://phpackages.com/packages/melvilleco-instagram-basic-display)
```

###  Alternatives

[wrav/oembed

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

36205.0k3](/packages/wrav-oembed)[craftpulse/craft-typesense

Craft Plugin that synchronises with Typesense

122.7k](/packages/craftpulse-craft-typesense)[jsmrtn/craftagram

Grab Instagram content through the Instagram API

141.3k](/packages/jsmrtn-craftagram)

PHPackages © 2026

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