PHPackages                             yizack/instagram-feed - 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. yizack/instagram-feed

ActiveLibrary[API Development](/categories/api)

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.

v2.0.0(1y ago)1215.6k↓50%321MITPHPPHP &gt;=7.3CI passing

Since Sep 29Pushed 7mo ago5 watchersCompare

[ Source](https://github.com/Yizack/instagram-feed)[ Packagist](https://packagist.org/packages/yizack/instagram-feed)[ RSS](/packages/yizack-instagram-feed/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (7)DependenciesVersions (8)Used By (1)

instagram-feed
==============

[](#instagram-feed)

[![Packagist](https://camo.githubusercontent.com/632fc811d8ade4afd765aee896cd4f43c728e8196185513dff7aa5bf66b613f0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f79697a61636b2f696e7374616772616d2d666565642e737667)](https://packagist.org/packages/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.

(Live [Demo](https://instagram-feed.yizack.com/demo/))

[![Live Demo](https://camo.githubusercontent.com/0c1f549d6506c3a9570daf15374f935b29f9432fc2f6745a784dc29656028bf1/68747470733a2f2f79697a61636b2e636f6d2f696d616765732f696e7374616772616d2d666565642f64656d6f2e676966)](https://instagram-feed.yizack.com/demo/)

Limitations
===========

[](#limitations)

- Only available for Instagram Business or Creator accounts. (Since December 4th, 2024. [Read the Basic Display API deprecation note](https://developers.facebook.com/blog/post/2024/09/04/update-on-instagram-basic-display-api/).)

Requeriments
------------

[](#requeriments)

- PHP Hosting (with `composer`, `file_get_contents()`, `file_put_contents()` support)
- Meta Developer App [\[Guide\]](#meta-developer-app)
- Instagram API [\[Guide\]](#instagram-api)

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

[](#installation)

To install the library, make sure you have [Composer](https://getcomposer.org/) installed and using your command terminal run the following:

```
composer require yizack/instagram-feed
```

Use
---

[](#use)

Installing this library will allow you to use the `InstagramFeed` class by simply importing the composer autoload.

Import the composer autoload, use the namespace `Yizack\InstagramFeed` and initialize the `InstagramFeed` object.

```
require "vendor/autoload.php";
use Yizack\InstagramFeed;

$feed = new InstagramFeed(
  "long-lived-access-token" // Paste your long-lived-access-token here
);
```

To retrieve your Instagram feed array use the `getFeed()` function.

```
$array = $feed->getFeed();
```

Or loop it directly in a `foreach` method wherever you need it.

```
foreach ($feed->getFeed() as $value) {
    // your code
}
```

The `getFeed()` function also accepts an array of fields to be returned.

```
$array = $feed->getFeed(["username", "permalink", "timestamp", "caption", "media_url"]);
```

For a list of all available fields see:

About the code
--------------

[](#about-the-code)

### `InstagramFeed` constructor arguments

[](#instagramfeed-constructor-arguments)

ArgumentTypeDescriptionOptionalDefault value`token`stringYour Instagram `long-lived-access-token`.No`path`stringThe path where the updated file will be saved on your server.Yes`ig_token``filename`stringThe name of the file in which the date of the last token update will be stored.Yes`updated.json`### `getFeed()` function

[](#getfeed-function)

Updates the date of the last token update and requests feed data from an Instagram account.

Returns an array with the data of the last 25 posts with the following data for each one:

KeyDescription`username`Instagram username.`permalink`Instagram post permalink.`timestamp`Instagram post timestamp.`caption`Instagram post caption.`id`Instagram post identifier.### Long-Lived Access token

[](#long-lived-access-token)

This approach uses **Long-Lived Access** Tokens obtained by authorizing your Instagram account with your Meta App.

Since Long-lived tokens are valid for 60 days and can be refreshed as long as they are at least 24 hours old and not expired, the `getFeed()` method will refresh your token everytime it is been called if 24 hours have passed.

Tokens that have not been refreshed in 60 days will expire and can no longer be refreshed, so be sure to visit often the site where you placed the feed.

Example of use
--------------

[](#example-of-use)

Check the [`example`](/example/) folder for details.

Requeriments Guide
------------------

[](#requeriments-guide)

### PHP Hosting

[](#php-hosting)

You can use any PHP Hosting unless it does not support `file_get_contents()` and `file_put_contents()`.

### Meta Developer App

[](#meta-developer-app)

In order to use the **Instagram API**, we must first create a **Meta App**. Follow the steps below to create a Meta App.

1. Go to [Meta for Developers site](https://developers.facebook.com/apps/create/), login and create App. Select the app type as **Business**. [![Meta App Step 1](https://private-user-images.githubusercontent.com/16264115/392078924-0e13c938-d479-43aa-a4cd-db95c89c6107.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzQ0MjQ2MTgsIm5iZiI6MTc3NDQyNDMxOCwicGF0aCI6Ii8xNjI2NDExNS8zOTIwNzg5MjQtMGUxM2M5MzgtZDQ3OS00M2FhLWE0Y2QtZGI5NWM4OWM2MTA3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjAzMjUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwMzI1VDA3MzgzOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTgyYTg4NmNmZDdhNDc1MmFiNTFiZGNkNjE4ZmM5Yjc4NDEyZWJjNWM5NjQ0ZWUwYTI5ZTRlZGM0NzU1MTQzY2YmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.mpGD9ehLBuOEWyXJpwn-cajTA9FnG9zoWNcCzuUHVcA)](https://developers.facebook.com/)
2. Provide your App details. [![Meta App Step 2](https://private-user-images.githubusercontent.com/16264115/392079605-805ab216-4ac6-4be0-95c5-ef5a49a6fa74.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzQ0MjQ2MTgsIm5iZiI6MTc3NDQyNDMxOCwicGF0aCI6Ii8xNjI2NDExNS8zOTIwNzk2MDUtODA1YWIyMTYtNGFjNi00YmUwLTk1YzUtZWY1YTQ5YTZmYTc0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjAzMjUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwMzI1VDA3MzgzOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWU4MWZjMDVhZjYxNThmN2U4ZmU4NDAxZjk5ZDcyNWI2MWJjYzIzMDczOGJjNzMxZGMwMjY2YzIzNWM1NmMyZmImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.bTEKTs_jJyAH38kxxffkDCxbjfaaemtzgJRUXo2_c-E)](https://developers.facebook.com/)

### Instagram API

[](#instagram-api)

Now it is time to authorize your Instagram Business or Creator account.

1. Look for **Instagram** product, and click on **Set up** to use the Instagram API. [![Instagram API Step 1](https://private-user-images.githubusercontent.com/16264115/392080054-e6f5eac4-dfe9-4f3e-8177-6ad903b81539.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzQ0MjQ2MTgsIm5iZiI6MTc3NDQyNDMxOCwicGF0aCI6Ii8xNjI2NDExNS8zOTIwODAwNTQtZTZmNWVhYzQtZGZlOS00ZjNlLTgxNzctNmFkOTAzYjgxNTM5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjAzMjUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwMzI1VDA3MzgzOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWExYmQ2NjE1Y2ZmYmYzNDI5NzJjNmVmOGE0ZDdmMjZjOTUxYzU1NTUwMTA1ODg4NjQ4MWU0MjFiYTg3MjdkYjgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.BDAG_bCAVAR_fUYSIvU9o928nd20uFZIgwSS6s5jLcE)](https://developers.facebook.com/)
2. In the **Generate access tokens** section, Click on the **Add account** button. [![Instagram API Step 2](https://private-user-images.githubusercontent.com/16264115/392081826-0a7ab7d5-da79-4a45-a808-5a1f7c7e1339.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzQ0MjQ2MTgsIm5iZiI6MTc3NDQyNDMxOCwicGF0aCI6Ii8xNjI2NDExNS8zOTIwODE4MjYtMGE3YWI3ZDUtZGE3OS00YTQ1LWE4MDgtNWExZjdjN2UxMzM5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjAzMjUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwMzI1VDA3MzgzOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWI5MzU4MGRkYWE3YmE1OGQ0YWYzNDkxYjA1NDU3NWUyMDA2NzU4MmRkNmJmYzJhYTU0OTBmY2ZmYTEwYTdlMWEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.k0KDof63NYNCw4BVY7gMH--_bSiFwiIA4jRmhl82jWI)](https://developers.facebook.com/)
3. Login using your Instagram Business or Creator account and allow the permissions. [![Instagram API Step 3](https://private-user-images.githubusercontent.com/16264115/392084819-597b3077-21ee-44ad-9eaa-259e49b48b87.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzQ0MjQ2MTgsIm5iZiI6MTc3NDQyNDMxOCwicGF0aCI6Ii8xNjI2NDExNS8zOTIwODQ4MTktNTk3YjMwNzctMjFlZS00NGFkLTllYWEtMjU5ZTQ5YjQ4Yjg3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjAzMjUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwMzI1VDA3MzgzOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWU2NWFlM2M5MmY4YzgxMTIyNjRjMzQ2NGFjOTU0OTM2Yzk0NTY0ZTA5YTY1NzMzNzhkZGEwNjNjNTRlOGYyYjEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.ZGCQ0hv3-daSgBup0bxa9TnWH4LB2FAlAtu77L5DJUk)](https://developers.facebook.com/)
4. Click on **Generate token**, allow the permissions, and copy the generated token inside the code. [![Instagram API Step 4](https://private-user-images.githubusercontent.com/16264115/392085497-0a0982e2-c7b7-488c-8942-028fdc4bae36.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzQ0MjQ2MTgsIm5iZiI6MTc3NDQyNDMxOCwicGF0aCI6Ii8xNjI2NDExNS8zOTIwODU0OTctMGEwOTgyZTItYzdiNy00ODhjLTg5NDItMDI4ZmRjNGJhZTM2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjAzMjUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwMzI1VDA3MzgzOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTViOTYzN2FmNGMyN2U4ZjNjNjA0NTk1ZDE0NDVhOGU1NTQ1MDY5Njc5YzEzNTc1NDI0ZDVlZmI1MTY0ZTNkMDkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.EQrdR9OE6mqss5IH7j5z16jttK7IAAyNYENrTJtJfTo)](https://developers.facebook.com/)
5. Paste your token in your code.

Repository
----------

[](#repository)

[Yizack/instagram-feed](https://github.com/Yizack/instagram-feed) on GitHub.

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance55

Moderate activity, may be stable

Popularity40

Moderate usage in the ecosystem

Community22

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 97.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 ~142 days

Recently: every ~131 days

Total

7

Last Release

467d ago

Major Versions

v1.1.3 → v2.0.02025-01-30

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/16264115?v=4)[Yizack Rangel](/maintainers/Yizack)[@Yizack](https://github.com/Yizack)

---

Top Contributors

[![Yizack](https://avatars.githubusercontent.com/u/16264115?v=4)](https://github.com/Yizack "Yizack (89 commits)")[![a-d-w-s](https://avatars.githubusercontent.com/u/59865811?v=4)](https://github.com/a-d-w-s "a-d-w-s (1 commits)")[![vachzar](https://avatars.githubusercontent.com/u/366703?v=4)](https://github.com/vachzar "vachzar (1 commits)")

---

Tags

facebookinstagraminstagram-apiinstagram-feedinstagram-profilephpinstagramfeedmeta

### Embed Badge

![Health badge](/badges/yizack-instagram-feed/health.svg)

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

###  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)[facebook/php-business-sdk

PHP SDK for Facebook Business

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

PHP SDK for Facebook Business

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

An easy-to-use PHP Class for accessing Instagram's API.

1.5k943.5k9](/packages/cosenary-instagram)[laminas/laminas-feed

provides functionality for creating and consuming RSS and Atom feeds

16749.2M47](/packages/laminas-laminas-feed)[mibe/feedwriter

Generate feeds in either RSS 1.0, RSS 2.0 or ATOM formats

1951.1M5](/packages/mibe-feedwriter)

PHPackages © 2026

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