PHPackages                             chill-pills/laravel-instagram-basic-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. chill-pills/laravel-instagram-basic-feed

AbandonedArchivedLibrary

chill-pills/laravel-instagram-basic-feed
========================================

Laravel package that connect to Instagram's new API Basic Display. Retrieve personal user's posts and keep them in cache, with specific commands or with Scheduler and take care to refresh the token's every two months.

0.3.0(4y ago)38553[3 issues](https://github.com/Chill-Pills/laravel-instagram-basic-feed/issues)MITPHPPHP ^7.3|^8.0

Since Mar 30Pushed 3y ago1 watchersCompare

[ Source](https://github.com/Chill-Pills/laravel-instagram-basic-feed)[ Packagist](https://packagist.org/packages/chill-pills/laravel-instagram-basic-feed)[ RSS](/packages/chill-pills-laravel-instagram-basic-feed/feed)WikiDiscussions master Synced yesterday

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

Laravel Instagram Basic Feed
============================

[](#laravel-instagram-basic-feed)

Laravel package connecting to Instagram's new API Basic Display. Retrieving personal user's posts and keep them in cache, with specific commands or with Scheduler, and taking charge of refreshing the Instagram token every two months.

Get started
-----------

[](#get-started)

To use the [Instagram Basic Display API](https://developers.facebook.com/docs/instagram-basic-display-api), you will need to register a Facebook app and configure Instagram Basic Display. Follow the [getting started guide](https://developers.facebook.com/docs/instagram-basic-display-api/getting-started).

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

[](#requirements)

- PHP 7 or higher
- cURL
- Facebook Developer Account
- Facebook App

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

[](#installation)

Install the package in your application by running

```
composer require chill-pills/laravel-instagram-basic-feed
```

Add and complete these lines in your .env file

```
INSTAGRAM_VALID_OAUTH_URI=
INSTAGRAM_APP_ID=
INSTAGRAM_SECRET_KEY=
INSTAGRAM_ACCESS_TOKEN=
```

For the `INSTAGRAM_VALID_OAUTH_URI` entry, you will use the same URI you used in the Valid OAuth Redirect URIs field when you created the Instagram App. We will retrieve the `INSTAGRAM_ACCESS_TOKEN` in the next steps. (Ensure all the other env entries are complete)

Set Up
------

[](#set-up)

We will need to go over the following steps to ensure our package is configure to work correctly;

- Permit your App to access your Instagram account’s profile and media
- Retrieve the Authorization code that from the URL
- Use the authorization code to obtain a short-lived API token
- Exchange the short-lived API token for a long-lived API token

### Permit your App to access your Instagram account’s profile and media

[](#permit-your-app-to-access-your-instagram-accounts-profile-and-media)

We need to generate a link which redirects the user to the Instagram “Authorization Window". You can generate the url by running the following command:

```
php artisan instagram-feed:get-authorization-url
```

Copy &amp; Enter the url in your browser (Your authorization window link should look something like this)

```
https://api.instagram.com/oauth/authorize
  ?client_id={INSTAGRAM_APP_ID}
  &redirect_uri={INSTAGRAM_VALID_OAUTH_URI}
  &scope=user_profile,user_media
  &response_type=code
```

Next, you will be shown the Authorization Window

[![Image of Yaktocat](https://camo.githubusercontent.com/bfcb11e2d18b6bcbd23a7d33bfe115f799e2bb21dbcd9bfcf3e5c7d35943b9e7/68747470733a2f2f6d69726f2e6d656469756d2e636f6d2f6d61782f3537322f312a635a6b6442596e31394f497979504c795054574162412e706e67)](https://camo.githubusercontent.com/bfcb11e2d18b6bcbd23a7d33bfe115f799e2bb21dbcd9bfcf3e5c7d35943b9e7/68747470733a2f2f6d69726f2e6d656469756d2e636f6d2f6d61782f3537322f312a635a6b6442596e31394f497979504c795054574162412e706e67)

Click on Authorize

### Retrieve the Authorization code that from the URL

[](#retrieve-the-authorization-code-that-from-the-url)

You will be redirected to the `INSTAGRAM_VALID_OAUTH_URI`. If you look in your browser’s URL bar, you should notice the URL has an authorization code that has been appended to the redirect URL. Something like this:

```
{INSTAGRAM_VALID_OAUTH_URI}?code=AQBv...Xw#_
```

Copy the authorization code, The authorization code in the redirect URL is everything after `code=` up to (but not including) the `#_` at the end.

### Use the authorization code to obtain a short-lived API token &amp; Exchange the short-lived API token for a long-lived API token

[](#use-the-authorization-code-to-obtain-a-short-lived-api-token--exchange-the-short-lived-api-token-for-a-long-lived-api-token)

Now with the authorization code we are going to generate access token we can use in our application. Use the command below generate the token. We generate long-lived `access_token` because those are valid for 60 days. Replace the `authorization_code` with the code from the last step.

```
php artisan instagram-feed:setup-new-access-token
```

Awesome! Now, with this long-lived access\_token, you can make requests to the API for the next 60 days. You can also refresh the token, extending for another 60 days as long as the token is not expired and is at least 24 hours old (and has not been revoked by your Instagram user deauthorizing your app).

Usage
-----

[](#usage)

There's two commands that lets you fetch your feed or renew the Access Token.

```
php artisan instagram-feed:crawl
php artisan instagram-feed:refresh-key
```

You can add the following scheduler's command to take care of executing those commands automatically

```
    protected function schedule(Schedule $schedule)
    {
        $schedule->command(InstagramCrawlFeed::class)->hourly();
        $schedule->command(InstagramRefreshAccessToken::class)->monthly();
    }
```

Don't forget to enable the CRON on your machine for Laravel Basic Scheduler in your app/Console/Kernel.php file

```
* * * * * cd /home/path/to/your/project && php artisan schedule:run >> /dev/null 2>&1
```

To show the Instagram feed on your page, you can just add the following Blade command to include the partial to your page.

```
@include('instagram-basic-feed::instagram-post')
```

You can pass to the @include a hashtag used to search through the posts

```
@include('instagram-basic-feed::instagram-post', ['hastag' => '#duckhunt'])
```

If you want to modify the view displaying the instagram posts itself

```
php artisan vendor:publish --tag=instagram-basic-feed-view
```

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~251 days

Total

4

Last Release

1479d ago

PHP version history (3 changes)0.1.0PHP ^7.2

0.2.0PHP ^7.3

0.3.0PHP ^7.3|^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/62867278?v=4)[chillpills](/maintainers/chill-pills)[@chill-pills](https://github.com/chill-pills)

---

Top Contributors

[![Otienoh](https://avatars.githubusercontent.com/u/8632640?v=4)](https://github.com/Otienoh "Otienoh (16 commits)")[![dib258](https://avatars.githubusercontent.com/u/4132137?v=4)](https://github.com/dib258 "dib258 (11 commits)")[![mho22](https://avatars.githubusercontent.com/u/17177411?v=4)](https://github.com/mho22 "mho22 (7 commits)")[![swilla](https://avatars.githubusercontent.com/u/304159?v=4)](https://github.com/swilla "swilla (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/chill-pills-laravel-instagram-basic-feed/health.svg)

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

###  Alternatives

[fumeapp/modeltyper

Generate TypeScript interfaces from Laravel Models

196277.9k](/packages/fumeapp-modeltyper)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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