alterebro/instagram-feed

Access the latest Instagram posts without using OAuth, Tokens or APIs

v0.1.4 2020-11-22 20:51 UTC

This package is auto-updated.

Last update: 2024-10-23 05:49:49 UTC


README

Get the latest pictures from an Instagram user or hashtag without OAuth credentials or access token. This is not using the Instagram API platform or Graph API so it doesn't need you to authenticate, authorise or register your application anywhere.

Installation

composer require alterebro/instagram-feed

How to use it

require __DIR__ . '/vendor/autoload.php';

use Alterebro\InstagramFeed;

$feed = new InstagramFeed(
    $query,     // i.e: "@alterebro"
    $cachePath  // i.e: __DIR__ . "/tmp/"
);
$feed->JSON();

Parameters

Mandatory :

  • $query : String starting with '@' to retrieve an username or without it to get a hashtag
  • $cachePath : Folder where to store the data. i.e: /tmp/ ( chmod 777 /tmp )

Optional

  • $feedItems : Items to retrieve. Defaults to 6 items.
  • $cacheTime : How long does the cache lasts. Defaults to 86400 seconds (1 day).
  • $cacheForce : Force to cache the data. Defaults to false.
// Retrive 10 items from user @alterebro and stores it on the /tmp/ folder for 12 hours / half day (43200 seconds)
$feed = new InstagramFeed('@alterebro', '/tmp/', 10, 43200);

// Get the data :
$data = $feed->load();

// or Output as JSON :
$feed->JSON();