Search by

jsonscraper / instagram-api-php

sergeykomlev

Instagram Scraper API client for PHP with Composer and response models

Package info

github.com/jsonscraper/instagram-api-php

Homepage

pkg:composer/jsonscraper/instagram-api-php

Statistics

Installs: 4

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

0.1.1 2026-10-25 07:07 UTC

This package is auto-updated.

Last update: 2026-10-25 08:36:27 UTC


README

Latest release PHP requirements Last commit MIT license Packagist version Packagist PHP support

Run in Postman

Composer client with LazyJsonMapper response models and ready-to-run examples. Supports 97 Instagram Scraper API methods.

Package: jsonscraper/instagram-api-php · Methods · Examples · Documentation

Quick start: API key, setup, first request, JSON response

Quick start

1. Get your key from the Instagram API product page and set it on your server:

export JSONSCRAPER_INSTAGRAM_LICENSE_KEY='your-license-key'

2. Install the package:

composer require jsonscraper/instagram-api-php:^0.1

3. Make a request:

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

$client = new JsonScraper\Instagram(getenv('JSONSCRAPER_INSTAGRAM_LICENSE_KEY'), models: true);
$response = $client->v1_user_by_username(['username'=>'apple', 'cache_timeout'=>60]);
if ($response->isOk() && $response->getIg()) {
    echo $response->getIg()->getUsername();
}

The API payload is in ig. Live calls require a valid API license and may consume quota. Response examples and status handling.

Main methods

97 methods are available. Common starting points:

What you need Method
Read a profile v1_user_by_username()
Read a profile by ID v1_user_by_id()
List profile posts v1_user_medias_chunk()
Read a post or reel v1_media_by_code()
Read comments v1_media_comments_chunk()
Search profiles v1_search_users()

All methods and parameters →

Ready-to-run examples

Each example includes command-line parameters, key setup, timeouts, error handling and response output. Run it with --help first; this makes no API request.

Browse all 97 complete examples · Full method and parameter reference

Response models

Use models: true for LazyJsonMapper objects such as Profile, Media, Comment and Collection. Use the default array mode for the full upstream envelope.

$profile = $response->getIg();
echo $profile->getUsername();
echo $profile->getFollowerCount();

Model hierarchy, media and collection examples · All model classes

Configuration

Requests use a 30-second timeout by default. Configure caching and retries to fit your application's request budget. Keys are read from your server environment; redirects are disabled.

Configuration options, HTTP errors, caching and pagination · Full integration guide

Use with ChatGPT and Codex

Prefer an assistant connection? Use the separate Instagram MCP server. It accepts the same product API license and uses the normal API quota. MCP source and setup.

Access, pricing and support

The SDK source is MIT-licensed. Hosted API access requires a separate Instagram license. Check current plans and get access.

Service support · SDK issues · Changelog · MIT license

Development

python3 tests/contract.py

Tests use a local/mock server and require no API key. A GitHub Actions template is available for optional automation.

The SDK has no installation or usage telemetry. README links use campaign parameters for website referral analytics. jsonscraper is independent and is not affiliated with Instagram or Meta.