A light-weight Instagram integration. Pull recent Instagram images into a Laravel website.

1.1.3 2019-09-04 17:24 UTC

This package is auto-updated.

Last update: 2022-05-04 23:41:47 UTC


A light-weight Instagram integration. Pull recent Instagram images into a Laravel website.


Install via composer:

$ composer require tristanward/tinygram


Tinygram requires an Instagram access token to access recent Instagram posts. Refer to the Instagram docs for help generating an access token.

The Instagram access token should be specified in the Laravel .env file:


Cache Instagram Posts

Instagram posts can be cached to limit calls to the Instagram API. To do this a tinyimages table must first be created:

php artisan migrate

To cache all recent Instagram posts use the tinygram:cache console command:

php artistan tinygram:cache

This command can be used in Laravel's default scheduler, for example to cache recent Instagram posts at 03:00 on Sundays:

// App/Console/Kernel.php

use Tristanward\Tinygram\Console\TinygramCache;

protected $commands = [

protected function schedule(Schedule $schedule)


Tinygram uses a Laravel facade:


use Tristanward\Tinygram\Facades\Tinygram;

// Get 9 most recent Cached Instagram posts
$cached = Tinygram::cachedMedia($count = 9);

// Get 9 most recent Instagram posts live from the Instagram API
$recent = Tinygram::recentMedia($count = 9);

// Get full raw data live from the Instagram API
$raw = Tinygram::recentMediaRaw($count = 9);


The cachedMedia() method returns a Laravel collection of Tinyimage objects. The underlying Instagram post information can be access using the Tinyimage object attributes:


Both the recentMedia() and recentMediaRaw() methods return a Laravel collection of arrays containing data from Instagram. Use dd() on the output of these methods to see available data.