承接 alirezaprogrammermaker/uninsta 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

alirezaprogrammermaker/uninsta

Composer 安装命令:

composer require alirezaprogrammermaker/uninsta

包简介

Unofficial Instagram API Client for PHP

README 文档

README

PHP Version License

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

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 & Likes: Retrieve post comments and likers
  • 🗂️ Session Management: Persistent session storage
  • 🔄 Clean Architecture: Well-organized, maintainable code

Installation

Install via Composer:

composer require alirezaprogrammermaker/uninsta

Quick Start

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

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

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

Usage Examples

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

// 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

// 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

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


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

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

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

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

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

  • PHP >= 8.0
  • GuzzleHTTP ^7.0

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

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

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

If you encounter any issues or have questions, please open an issue on GitHub.

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-12-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固