PHPackages                             ramsey/laravel-oauth2-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. ramsey/laravel-oauth2-instagram

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

ramsey/laravel-oauth2-instagram
===============================

A Laravel 5 service provider for league/oauth2-instagram.

3.0.0(7y ago)2910.8k9[2 issues](https://github.com/ramsey/laravel-oauth2-instagram/issues)[1 PRs](https://github.com/ramsey/laravel-oauth2-instagram/pulls)MITPHPPHP ^7.1.3

Since Dec 27Pushed 6y agoCompare

[ Source](https://github.com/ramsey/laravel-oauth2-instagram)[ Packagist](https://packagist.org/packages/ramsey/laravel-oauth2-instagram)[ Docs](https://github.com/ramsey/laravel-oauth2-instagram)[ RSS](/packages/ramsey-laravel-oauth2-instagram/feed)WikiDiscussions master Synced today

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

ramsey/laravel-oauth2-instagram
===============================

[](#ramseylaravel-oauth2-instagram)

[![Source Code](https://camo.githubusercontent.com/6ceed3739d519196cf18f66fe75dd4e122458b8af26f1990210293fd7162a51d/687474703a2f2f696d672e736869656c64732e696f2f62616467652f736f757263652d72616d7365792f6c61726176656c2d2d6f61757468322d2d696e7374616772616d2d626c75652e7376673f7374796c653d666c61742d737175617265)](https://github.com/ramsey/laravel-oauth2-instagram)[![Latest Version](https://camo.githubusercontent.com/8ac3545bd80ca6f8df8ba253175edcb82b83589e17a788252baac245479abbe0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f72616d7365792f6c61726176656c2d6f61757468322d696e7374616772616d2e7376673f7374796c653d666c61742d737175617265266c6162656c3d72656c65617365)](https://packagist.org/packages/ramsey/laravel-oauth2-instagram)[![Software License](https://camo.githubusercontent.com/a8853b09789a291eafe0e7dcc6ddf7d958558609f856b5ed468d4cd6b8f61f05/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f72616d7365792f6c61726176656c2d6f61757468322d696e7374616772616d2e7376673f7374796c653d666c61742d737175617265)](https://github.com/ramsey/laravel-oauth2-instagram/blob/master/LICENSE)[![PHP Version](https://camo.githubusercontent.com/1f80d8781c4cfadb9f0db515e831b243db301291c7f4d1c10dd9867c4a13701d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f72616d7365792f6c61726176656c2d6f61757468322d696e7374616772616d2e7376673f7374796c653d666c61742d737175617265)](https://php.net)[![Build Status](https://camo.githubusercontent.com/c9a641af707e887df7a3d570be7574ecec065facd3e8dff31f9480b70fe49e4e/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f72616d7365792f6c61726176656c2d6f61757468322d696e7374616772616d2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/ramsey/laravel-oauth2-instagram)[![Coverage Status](https://camo.githubusercontent.com/cd4c29f86d3af9252c8fc0d6a9f02e95e216abcc49984dc01de691446507b1b5/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f6769746875622f72616d7365792f6c61726176656c2d6f61757468322d696e7374616772616d2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://coveralls.io/r/ramsey/laravel-oauth2-instagram?branch=master)[![Total Downloads](https://camo.githubusercontent.com/93f1b2c2dc8026cd62c7c5d89c8997d2e0072f384cc86dfc85290eb54945541c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f72616d7365792f6c61726176656c2d6f61757468322d696e7374616772616d2e7376673f7374796c653d666c61742d73717561726526636f6c6f72423d6d656469756d76696f6c6574726564)](https://packagist.org/packages/ramsey/laravel-oauth2-instagram)

ramsey/laravel-oauth2-instagram is a [Laravel 5](https://laravel.com/) service provider for [league/oauth2-instagram](https://github.com/thephpleague/oauth2-instagram).

This project adheres to a [Contributor Code of Conduct](https://github.com/ramsey/laravel-oauth2-instagram/blob/master/.github/CODE_OF_CONDUCT.md). By participating in this project and its community, you are expected to uphold this code.

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

[](#installation)

The preferred method of installation is via [Composer](http://getcomposer.org/). Run the following command to install the package and add it as a requirement to your project's `composer.json`:

```
composer require ramsey/laravel-oauth2-instagram
```

After requiring the package with Composer, you'll need to add the following to the `providers` array in `config/app.php`:

```
Ramsey\Laravel\OAuth2\Instagram\InstagramServiceProvider::class
```

Then, add the following to the `aliases` array in the same file:

```
'Instagram' => Ramsey\Laravel\OAuth2\Instagram\Facades\Instagram::class
```

Now, run the following to properly set up the package with your Laravel application:

```
php artisan vendor:publish
```

Finally, [register your application with Instagram](https://www.instagram.com/developer/)and add your client ID, client secret, and redirect URI to `config/instagram.php`.

Examples
--------

[](#examples)

Create an authorization URL and redirect users to it in order to request access to their Instagram account:

```
$authUrl = Instagram::authorize([], function ($url, $provider) use ($request) {
    $request->session()->put('instagramState', $provider->getState());
    return $url;
});

return redirect()->away($authUrl);
```

In the route for the redirect URI, check the state and authorization code, and use the code to get an access token. Store the token to the session or to the user's profile in your data store.

```
if (!$request->has('state') || $request->state !== $request->session()->get('instagramState')) {
    abort(400, 'Invalid state');
}

if (!$request->has('code')) {
    abort(400, 'Authorization code not available');
}

$token = Instagram::getAccessToken('authorization_code', [
    'code' => $request->code,
]);

$request->session()->put('instagramToken', $token);
```

Use the access token to make authenticated requests to Instagram.

```
$instagramToken = $request->session()->get('instagramToken');

$instagramUser = Instagram::getResourceOwner($instagramToken);
$name = $instagramUser->getName();
$bio = $instagramUser->getDescription();

$feedRequest = Instagram::getAuthenticatedRequest(
    'GET',
    'https://api.instagram.com/v1/users/self/feed',
    $instagramToken
);

$client = new \GuzzleHttp\Client();
$feedResponse = $client->send($feedRequest);
$instagramFeed = json_decode($feedResponse->getBody()->getContents());
```

Contributing
------------

[](#contributing)

Contributions are welcome! Please read [CONTRIBUTING](https://github.com/ramsey/laravel-oauth2-instagram/blob/master/.github/CONTRIBUTING.md) for details.

Copyright and License
---------------------

[](#copyright-and-license)

The ramsey/laravel-oauth2-instagram library is copyright © [Ben Ramsey](https://benramsey.com)and licensed for use under the MIT License (MIT). Please see [LICENSE](https://github.com/ramsey/laravel-oauth2-instagram/blob/master/LICENSE) for more information.

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity32

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 94.1% 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 ~553 days

Total

3

Last Release

2731d ago

Major Versions

1.0.0 → 2.0.02017-04-06

2.0.0 → 3.0.02019-01-07

PHP version history (3 changes)1.0.0PHP &gt;=5.5.0

2.0.0PHP ^5.6 || ^7.0

3.0.0PHP ^7.1.3

### Community

Maintainers

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

---

Top Contributors

[![ramsey](https://avatars.githubusercontent.com/u/42941?v=4)](https://github.com/ramsey "ramsey (16 commits)")[![matthewtrask](https://avatars.githubusercontent.com/u/4731244?v=4)](https://github.com/matthewtrask "matthewtrask (1 commits)")

---

Tags

instagramlaraveloauth2phpphp7laravelinstagramoauth2

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/ramsey-laravel-oauth2-instagram/health.svg)

```
[![Health](https://phpackages.com/badges/ramsey-laravel-oauth2-instagram/health.svg)](https://phpackages.com/packages/ramsey-laravel-oauth2-instagram)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M337](/packages/psalm-plugin-laravel)[renatomarinho/laravel-page-speed

Laravel Page Speed

2.5k1.7M11](/packages/renatomarinho-laravel-page-speed)[vinkius-labs/laravel-page-speed

Laravel Page Speed

2.5k9.6k1](/packages/vinkius-labs-laravel-page-speed)[webwizo/laravel-shortcodes

Wordpress like shortcodes for Laravel 11, 12 and 13

223700.9k8](/packages/webwizo-laravel-shortcodes)[emargareten/inertia-modal

Inertia Modal is a Laravel package that lets you implement backend-driven modal dialogs for Inertia apps.

90142.9k](/packages/emargareten-inertia-modal)[erag/laravel-pwa

A simple and easy-to-use PWA (Progressive Web App) package for Laravel applications.

177124.1k](/packages/erag-laravel-pwa)

PHPackages © 2026

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