PHPackages                             alirezaprogrammermaker/uninsta - 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. [API Development](/categories/api)
4. /
5. alirezaprogrammermaker/uninsta

ActiveLibrary[API Development](/categories/api)

alirezaprogrammermaker/uninsta
==============================

Unofficial Instagram API Client for PHP

00PHP

Since Dec 18Pushed 5mo agoCompare

[ Source](https://github.com/alirezaprogrammermaker/uninsta)[ Packagist](https://packagist.org/packages/alirezaprogrammermaker/uninsta)[ RSS](/packages/alirezaprogrammermaker-uninsta/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

UnInsta - Unofficial Instagram API Client
=========================================

[](#uninsta---unofficial-instagram-api-client)

[![PHP Version](https://camo.githubusercontent.com/d0a73a70cac6e07fb720c4c6f907c7da2c49ca5cf14fdbfe485582b2ca326fcb/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253545372e322d626c7565)](https://php.net)[![License](https://camo.githubusercontent.com/784362b26e4b3546254f1893e778ba64616e362bd6ac791991d2c9e880a3a64e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e2e737667)](LICENSE)

A powerful and easy-to-use PHP library for interacting with Instagram's unofficial API.

Features
--------

[](#features)

- 🔐 **Authentication**: Login with session ID
- 👤 **User Management**: Get user profiles, search users
- 📸 **Posts**: Retrieve user posts with pagination
- 📖 **Stories**: Access user stories
- ⭐ **Highlights**: Get user highlights
- 💬 **Comments &amp; Likes**: Retrieve post comments and likers
- 🗂️ **Session Management**: Persistent session storage
- 🔄 **Clean Architecture**: Well-organized, maintainable code

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

[](#installation)

Install via Composer:

```
composer require alirezaprogrammermaker/uninsta
```

Quick Start
-----------

[](#quick-start)

### Basic Usage

[](#basic-usage)

```
use AlirezaProgrammerMaker\UnInsta\UnInsta;

// Initialize with session ID
$instagram = new UnInsta('your_session_id_here');

// Get current user
$currentUser = $instagram->getCurrentUser();
print_r($currentUser);
```

### Login and Save Session

[](#login-and-save-session)

```
$instagram = new UnInsta();
$user = $instagram->loginWithSessionId('your_session_id');

if ($user) {
    echo "Logged in as: " . $user['username'];
}
```

Usage Examples
--------------

[](#usage-examples)

### User Operations

[](#user-operations)

```
// Get user by username
$user = $instagram->getUserByUsername('instagram');
echo $user['full_name'];

// Get user by ID
$user = $instagram->getUserById('25025320');

// Search users
$results = $instagram->searchUsers('cristiano');
```

### Posts

[](#posts)

```
// Get user posts (with pagination)
$posts = $instagram->getPosts('instagram', 12);

foreach ($posts['posts'] as $post) {
    echo $post['caption']['text'];
}

// Load more posts
if (isset($posts['max_id'])) {
    $morePosts = $instagram->getPosts('instagram', 12, $posts['max_id']);
}

// Get specific post
$post = $instagram->getPostById('media_id_here');

// Get post comments
$comments = $instagram->getPostComments('media_id_here');

// Get post likers
$likers = $instagram->getPostLikers('media_id_here');
```

### Stories

[](#stories)

```
// Get user stories
$stories = $instagram->getUserStories('user_id_here');

foreach ($stories as $story) {
    echo $story['taken_at'];
}

// Get multiple users' stories
$stories = $instagram->getMultipleStories(['user_id_1', 'user_id_2']);
```

### Highlights

[](#highlights)

```
// Get user highlights
$highlights = $instagram->getUserHighlights('user_id_here');

// Get highlight media
$media = $instagram->getHighlightMedia('highlight_id_here');
```

### Advanced Configuration

[](#advanced-configuration)

```
// With proxy
$instagram = new UnInsta(
    sessionId: 'your_session_id',
    cookies: [],
    proxy: 'http://proxy-server:port'
);

// Custom session storage path
$instagram->setSessionStoragePath('/custom/path/to/sessions');
```

Session Management
------------------

[](#session-management)

Sessions are automatically saved and can be reused:

```
use AlirezaProgrammerMaker\UnInsta\Session\SessionManager;

// Get session by username
$session = SessionManager::getByUsername('username');

// Get session by session ID
$session = SessionManager::getBySessionId('session_id');

// Delete session
SessionManager::delete('username');

// Get all sessions
$allSessions = SessionManager::all();
```

Architecture
------------

[](#architecture)

The package is organized into logical components:

```
src/
├── Client/          # HTTP client implementation
├── Session/         # Session management
├── Api/             # API endpoints (User, Post, Story, Highlight)
├── Support/         # Helper classes (Constants, ResponseHandler)
├── Exceptions/      # Custom exceptions
└── UnInsta.php      # Main facade class

```

Error Handling
--------------

[](#error-handling)

```
use AlirezaProgrammerMaker\UnInsta\Exceptions\ApiException;
use AlirezaProgrammerMaker\UnInsta\Exceptions\AuthenticationException;

try {
    $user = $instagram->getUserByUsername('nonexistent');
} catch (ApiException $e) {
    echo "API Error: " . $e->getMessage();
} catch (AuthenticationException $e) {
    echo "Auth Error: " . $e->getMessage();
}
```

Requirements
------------

[](#requirements)

- PHP &gt;= 8.0
- GuzzleHTTP ^7.0

Security Note
-------------

[](#security-note)

This is an **unofficial** Instagram API client. Use it responsibly and be aware of Instagram's terms of service. Session IDs should be kept secure and never shared publicly.

Contributing
------------

[](#contributing)

Contributions are welcome! Please feel free to submit a Pull Request.

License
-------

[](#license)

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

Disclaimer
----------

[](#disclaimer)

This project is not affiliated with, authorized, maintained, sponsored or endorsed by Instagram or any of its affiliates or subsidiaries. This is an independent and unofficial API client.

Support
-------

[](#support)

If you encounter any issues or have questions, please [open an issue](https://github.com/alirezaprogrammermaker/uninsta/issues) on GitHub.

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance50

Moderate activity, may be stable

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity12

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/9eb80bfc90cb42e09a698d844cfb380f7d4c64f21fcb9e1ac1e1aa5ab595e2be?d=identicon)[alireza programmer](/maintainers/alireza%20programmer)

---

Top Contributors

[![alirezaprogrammermaker](https://avatars.githubusercontent.com/u/74681914?v=4)](https://github.com/alirezaprogrammermaker "alirezaprogrammermaker (6 commits)")

### Embed Badge

![Health badge](/badges/alirezaprogrammermaker-uninsta/health.svg)

```
[![Health](https://phpackages.com/badges/alirezaprogrammermaker-uninsta/health.svg)](https://phpackages.com/packages/alirezaprogrammermaker-uninsta)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[facebook/php-business-sdk

PHP SDK for Facebook Business

90821.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

74513.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

265103.1M454](/packages/google-gax)[google/common-protos

Google API Common Protos for PHP

173103.7M50](/packages/google-common-protos)

PHPackages © 2026

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