Laravel 5 Instagram API tutorial with example

Laravel 5 Instagram API tutorial with example

In this post we will give you information about Laravel 5 Instagram API tutorial with example. Hear we will give you detail about Laravel 5 Instagram API tutorial with exampleAnd how to use it also give you demo for it if it is necessary.

Today, I am going to show you how to access Instagram Feed using instagram API. We can get our instagram feed without using any composer package, I simply use GuzzleHttp for getting instagram feed, We can also get location, likes, comments, images, name, id and etc.

GuzzleHttp provide use fire get request to given api, So i simply run “” API like, It is very basic example without generate instagram token. Here you can access feed of any user by username.

This example is very simple and you can get by follow few step, you can also check demo and after run successfully this example, you will find following preview. So let’s follow few step:


Step 1: Create Route

In this step, we require to create one route for manage view layout and get method for getting username. so open your routes/web.php file and add following route.


Route::get('instagram', 'InstagramController@index');

Step 2: Create Controller

In this point, now we should create new controller call InstagramController in this path app/Http/Controllers/InstagramController.php. In this controller we will manage route method, i added one method in this controller as listed bellow:

1) index()

So, copy bellow code and put in your controller file.



namespace AppHttpControllers;

use IlluminateHttpRequest;

use AppHttpRequests;

class InstagramController extends Controller



* Get the index name for the model.


* @return string


public function index(Request $request)


$items = [];


$client = new GuzzleHttpClient;

$url = sprintf('', $request->input('username'));

$response = $client->get($url);

$items = json_decode((string) $response->getBody(), true)['items'];


return view('instagram',compact('items'));



Also see:How to create and check custom header with middleware for REST API in Laravel 5 ?

Step 3: Create View

In this step, we have to create total one blade file as listed bellow:

1. instagram.blade.php

This both blade file will help to render layout of instagram data, so let’s create file view file and put bellow code.


<!DOCTYPE html>



<title>Laravel 5 Instagram API tutorial with example</title>

<link rel="stylesheet" type="text/css" href="">



<div >

<h2>Laravel 5 Instagram API tutorial with example</h2><br/>

<form method="GET" role="form">

<div >

<div >

<div >

<input type="text" id="username" name="username" placeholder="Enter Instagram Username" value="{{ old('username') }}">



<div >

<div >

<button >Search</button>





<div >

<div >Instagram Feed</div>

<div >

<table >



<th width="200px;">Id</th>




<th>Total Likes</th>

<th>Total Comments</th>




@foreach($items as $key => $item)


<td>{{ ++$key }}</td>

<td>{{ $item['id'] }}</td>

<td>{{ $item['code'] }}</td>

<td><img src="{{ $item['images']['standard_resolution']['url'] }}" style="width:100px;"></td>

<td>{{ isset($item['location']['name']) ? $item['location']['name'] : '' }}</td>

<td>{{ $item['likes']['count'] }}</td>

<td>{{ $item['comments']['count'] }}</td>





<td colspan="4">There are no data.</td>










Ok, now you can run example and check.

Note: If you found “Class ‘GuzzleHttpClient’ not found” Then run bellow command :

Also see:PHP – autocomplete websites with domain and logo using clearbit API
composer require guzzlehttp/guzzle

I hope it can help you…

Hope this code and post will helped you for implement Laravel 5 Instagram API tutorial with example. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs

For More Info See :: laravel And github

Leave a Comment

Your email address will not be published. Required fields are marked *

68  +    =  73

We're accepting well-written guest posts and this is a great opportunity to collaborate : Contact US