PHPackages                             ravelinodecastro/instagram-php-scraper - 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. ravelinodecastro/instagram-php-scraper

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

ravelinodecastro/instagram-php-scraper
======================================

Instagram PHP Scraper. Get account information, photos and videos without any authorization

v0.11.1(5y ago)025MITPHPPHP &gt;=7.2

Since Apr 22Pushed 4y agoCompare

[ Source](https://github.com/ravelinodecastro/instagram-php-scraper)[ Packagist](https://packagist.org/packages/ravelinodecastro/instagram-php-scraper)[ Docs](https://github.com/raiym/instagram-php-scraper)[ RSS](/packages/ravelinodecastro-instagram-php-scraper/feed)WikiDiscussions any-proxy-api Synced 2d ago

READMEChangelogDependencies (6)Versions (106)Used By (0)

Instagram PHP Scraper (Using any Proxy API)
===========================================

[](#instagram-php-scraper-using-any-proxy-api)

This library is based on the [postaddictme](https://github.com/postaddictme/instagram-php-scrape/) and [restyler](https://github.com/restyler/instagram-php-scraper/) libary versions. The difference is that my version can be associated with any proxy API. I've decided to build this version, because the restyler version was giving this message: "You have exceeded the MONTHLY quota for Requests on your current plan, BASIC." and it can only work with one proxy API and the postaddictme version do not allow us to use a proxy API directly.

Dependencies
------------

[](#dependencies)

- PHP &gt;= 7.2
- [PSR-16](http://www.php-fig.org/psr/psr-16/)
- [PSR-18](http://www.php-fig.org/psr/psr-18/)

Only these methods can use proxy API because they do not require authentication:

- getAccount()
- getAccountById()
- getMedias()
- getMediasByTag()
- getMediaByUrl()
- getMediaByCode()

Exemple using restyler's Rapid Api ([Click here to subscribe on his Proxy API](https://rapidapi.com/restyler/api/instagram40/))
-------------------------------------------------------------------------------------------------------------------------------

[](#exemple-using-restylers-rapid-api-click-here-to-subscribe-on-his-proxy-api)

```
$instagram = new \InstagramScraper\Instagram();
$instagram->getProxyApiUrl('https://instagram40.p.rapidapi.com/proxy?url={instagram_url}'); // do not remove {instagram_url}, it is later replaced by the instagram endpoints
$instagram->setHeaders(['x-rapidapi-key'=>'YOUR-RAPID-API-KEY']); // this is where you add your api key
$nonPrivateAccountMedias = $instagram->getMedias('kevin');
echo $nonPrivateAccountMedias[0]->getLink();
```

Exemple using scraperapi ([Click here to subscribe on his Proxy API](https://www.scraperapi.com/))
--------------------------------------------------------------------------------------------------

[](#exemple-using-scraperapi-click-here-to-subscribe-on-his-proxy-api)

```
$instagram = new \InstagramScraper\Instagram();
$instagram->getProxyApiUrl('http://api.scraperapi.com?api_key=YOUR-SCRAPPER-API-KEY&url={instagram_url}'); // do not remove {instagram_url}, it is later replaced by the instagram endpoints
$nonPrivateAccountMedias = $instagram->getMedias('kevin');
echo $nonPrivateAccountMedias[0]->getLink();
```

Other methods that can be used in this libary are:

- getProxyApiUrl('string') : used to check and check if your Proxy API url is set
- clearProxyApiUrl() : to clear the previous url set if you don't want to make request with proxy API anymore
- setHeaders($array): is used to set headers, in case you want add them in your proxy API Request

From here, all the rest is just the same as it is on postaddictme library
-------------------------------------------------------------------------

[](#from-here-all-the-rest-is-just-the-same-as-it-is-on-postaddictme-library)

Code Example
------------

[](#code-example)

```
$instagram = \InstagramScraper\Instagram::withCredentials(new \GuzzleHttp\Client(), 'username', 'password');
$instagram->login();
$account = $instagram->getAccountById(3);
echo $account->getUsername();
```

Some methods do not require authentication:

```
$instagram = new \InstagramScraper\Instagram(new \GuzzleHttp\Client());
$nonPrivateAccountMedias = $instagram->getMedias('kevin');
echo $nonPrivateAccountMedias[0]->getLink();
```

If you use authentication it is recommended to cache the user session. In this case you don't need to run the `$instagram->login()` method every time your program runs:

```
use Phpfastcache\Helper\Psr16Adapter;

$instagram = \InstagramScraper\Instagram::withCredentials(new \GuzzleHttp\Client(), 'username', 'password', new Psr16Adapter('Files'));
$instagram->login(); // will use cached session if you want to force login $instagram->login(true)
$instagram->saveSession();  //DO NOT forget this in order to save the session, otherwise have no sense
$account = $instagram->getAccountById(3);
echo $account->getUsername();
```

Using proxy for requests:

```
// https://docs.guzzlephp.org/en/stable/request-options.html#proxy
$instagram = new \InstagramScraper\Instagram(new \GuzzleHttp\Client(['proxy' => 'tcp://localhost:8125']));
// Request with proxy
$account = $instagram->getAccount('kevin');
\InstagramScraper\Instagram::setHttpClient(new \GuzzleHttp\Client());
// Request without proxy
$account = $instagram->getAccount('kevin');
```

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

[](#installation)

### Using composer

[](#using-composer)

```
composer.phar require ravelinodecastro/instagram-php-scraper
```

or

```
composer require ravelinodecastro/instagram-php-scraper
```

### If you don't have composer

[](#if-you-dont-have-composer)

You can download it [here](https://getcomposer.org/download/).

Examples
--------

[](#examples)

See examples [here](https://github.com/postaddictme/instagram-php-scraper/tree/master/examples).

Other
-----

[](#other)

Java library:

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 70.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 ~17 days

Recently: every ~34 days

Total

103

Last Release

1927d ago

PHP version history (2 changes)v0.0.1PHP &gt;=5.4.0

v0.10.0PHP &gt;=7.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/43408517?v=4)[Ravelino De Castro](/maintainers/ravelinodecastro)[@ravelinodecastro](https://github.com/ravelinodecastro)

---

Top Contributors

[![raiym](https://avatars.githubusercontent.com/u/5698585?v=4)](https://github.com/raiym "raiym (307 commits)")[![congkv](https://avatars.githubusercontent.com/u/3295246?v=4)](https://github.com/congkv "congkv (20 commits)")[![ricdijk](https://avatars.githubusercontent.com/u/2226726?v=4)](https://github.com/ricdijk "ricdijk (9 commits)")[![adam-szabo](https://avatars.githubusercontent.com/u/6370455?v=4)](https://github.com/adam-szabo "adam-szabo (8 commits)")[![Geolim4](https://avatars.githubusercontent.com/u/1332071?v=4)](https://github.com/Geolim4 "Geolim4 (7 commits)")[![aik27](https://avatars.githubusercontent.com/u/6603084?v=4)](https://github.com/aik27 "aik27 (7 commits)")[![Mulkave](https://avatars.githubusercontent.com/u/2647333?v=4)](https://github.com/Mulkave "Mulkave (5 commits)")[![vitaly-alexandrovich](https://avatars.githubusercontent.com/u/11419996?v=4)](https://github.com/vitaly-alexandrovich "vitaly-alexandrovich (5 commits)")[![alexpablo](https://avatars.githubusercontent.com/u/1921893?v=4)](https://github.com/alexpablo "alexpablo (5 commits)")[![drthief](https://avatars.githubusercontent.com/u/243979?v=4)](https://github.com/drthief "drthief (5 commits)")[![wrinkleydog](https://avatars.githubusercontent.com/u/9877090?v=4)](https://github.com/wrinkleydog "wrinkleydog (4 commits)")[![elliott-beach](https://avatars.githubusercontent.com/u/13651458?v=4)](https://github.com/elliott-beach "elliott-beach (4 commits)")[![mohsen-farahani](https://avatars.githubusercontent.com/u/2861717?v=4)](https://github.com/mohsen-farahani "mohsen-farahani (4 commits)")[![notdest](https://avatars.githubusercontent.com/u/7280120?v=4)](https://github.com/notdest "notdest (4 commits)")[![eversionsystems](https://avatars.githubusercontent.com/u/20215473?v=4)](https://github.com/eversionsystems "eversionsystems (3 commits)")[![NabiKAZ](https://avatars.githubusercontent.com/u/246721?v=4)](https://github.com/NabiKAZ "NabiKAZ (3 commits)")[![aleksei-s-popov](https://avatars.githubusercontent.com/u/3368890?v=4)](https://github.com/aleksei-s-popov "aleksei-s-popov (3 commits)")[![sakalauskas](https://avatars.githubusercontent.com/u/1455148?v=4)](https://github.com/sakalauskas "sakalauskas (3 commits)")[![Sorgor](https://avatars.githubusercontent.com/u/2776791?v=4)](https://github.com/Sorgor "Sorgor (3 commits)")[![mnajafzadeh](https://avatars.githubusercontent.com/u/5845453?v=4)](https://github.com/mnajafzadeh "mnajafzadeh (3 commits)")

---

Tags

instagramscraper

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ravelinodecastro-instagram-php-scraper/health.svg)

```
[![Health](https://phpackages.com/badges/ravelinodecastro-instagram-php-scraper/health.svg)](https://phpackages.com/packages/ravelinodecastro-instagram-php-scraper)
```

###  Alternatives

[raiym/instagram-php-scraper

Instagram PHP Scraper. Get account information, photos and videos without any authorization

3.3k1.2M6](/packages/raiym-instagram-php-scraper)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

728272.9k20](/packages/civicrm-civicrm-core)[nelexa/google-play-scraper

Scrapes app data from Google Play store.

88487.4k](/packages/nelexa-google-play-scraper)[crwlr/crawler

Web crawling and scraping library.

37214.8k2](/packages/crwlr-crawler)[shopware/app-php-sdk

Shopware App SDK for PHP

1577.8k1](/packages/shopware-app-php-sdk)

PHPackages © 2026

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