定制 reelflow/reelflow-php 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

reelflow/reelflow-php

Composer 安装命令:

composer require reelflow/reelflow-php

包简介

Elegant and powerful Instagram video downloader for seamless content extraction

README 文档

README

A modern, elegant PHP library for downloading Instagram reels with ease.

PHP Version License Status

✨ Features

  • 🎯 Download videos from Instagram reels
  • 🖼️ Get reel thumbnails
  • 🚀 Simple and intuitive API
  • 🔄 Automatic fallback mechanisms
  • 🛡️ Comprehensive error handling
  • 🔍 Smart reel URL validation

📦 Installation

Install via Composer:

composer require reelflow/reelflow-php

🚀 Quick Start

Basic Usage

use Code3\ReelFlow\ReelFlow;
use Code3\ReelFlow\InstagramException;

// Create an instance
$downloader = new ReelFlow();

try {
    // Get reel information
    $video = $downloader->getVideoInfo('https://www.instagram.com/reel/xyz123/');
    
    // Access reel details
    echo $video->getVideoUrl();      // Direct video URL
    echo $video->getThumbnailUrl();  // Thumbnail URL
    echo $video->getWidth();         // Video width
    echo $video->getHeight();        // Video height
    echo $video->getUsername();      // Creator's username
    echo $video->getDescription();   // Reel description
} catch (InstagramException $e) {
    echo "Error {$e->getStatusCode()}: {$e->getMessage()}";
}

Using the Facade

use Code3\ReelFlow\ReelflowFacade;

// Use the static facade method
$video = ReelflowFacade::getVideoInfo('https://www.instagram.com/reel/xyz123/');

📋 API Reference

ReelFlow Class

getVideoInfo(string $url): VideoInfo

Retrieves video information from an Instagram reel URL.

  • Parameters:
    • $url (string): The Instagram reel URL
  • Returns: VideoInfo object
  • Throws: InstagramException

VideoInfo Class

Methods:

  • getVideoUrl(): string - Get the direct video URL
  • getThumbnailUrl(): string - Get thumbnail image URL
  • getWidth(): int - Get video width
  • getHeight(): int - Get video height
  • getUsername(): string - Get the username of the reel creator
  • getDescription(): string - Get the reel description
  • toArray(): array - Get all info as array

Example using toArray():

$video = $downloader->getVideoInfo($url);
$videoData = $video->toArray();

// Access data from array
echo $videoData['videoUrl'];     // Direct video URL
echo $videoData['thumbnailUrl']; // Thumbnail URL
echo $videoData['width'];        // Video width
echo $videoData['height'];       // Video height
echo $videoData['username'];     // Creator's username
echo $videoData['description'];  // Reel description

InstagramException Class

Extends PHP's built-in Exception class with additional status code information.

Methods:

  • getStatusCode(): int - Get HTTP status code
  • getMessage(): string - Get error message

🌟 Examples

Handling Different Reel URL Formats

// Regular reel URL
$url1 = 'https://www.instagram.com/reel/xyz123/';

// Short reel URL
$url2 = 'https://www.instagram.com/reels/xyz123/';

// URL with parameters
$url3 = 'https://www.instagram.com/reel/xyz123/?utm_source=ig_web_copy_link';

Error Handling

try {
    $video = $downloader->getVideoInfo($url);
    
    if ($video) {
        // Process reel video
        $videoUrl = $video->getVideoUrl();
        // Download or stream video
    } else {
        echo "No reel information found";
    }
} catch (InstagramException $e) {
    switch ($e->getStatusCode()) {
        case 400:
            echo "Invalid reel URL format";
            break;
        case 404:
            echo "Reel not found";
            break;
        case 500:
            // Handle various 500 error cases
            if (strpos($e->getMessage(), 'Failed to parse server response') !== false) {
                echo "Error: Instagram API response was malformed";
            } elseif (strpos($e->getMessage(), 'Failed to connect to Instagram server') !== false) {
                echo "Error: Could not establish connection with Instagram";
            } elseif (strpos($e->getMessage(), 'Instagram server error') !== false) {
                echo "Error: Instagram server is experiencing issues";
            } elseif (strpos($e->getMessage(), 'Failed to extract video dimensions') !== false) {
                echo "Error: Could not retrieve video dimensions";
            } else {
                echo "Internal server error: " . $e->getMessage();
            }
            break;
        default:
            echo "Error: " . $e->getMessage();
    }
}

🛠️ Development

Requirements

  • PHP 7.4 or higher
  • Composer
  • GuzzleHttp Client
  • Symfony DomCrawler

📞 Support

📄 License

MIT © Hossein Pira

Made with ❤️ by Hossein Pira

reelflow/reelflow-php 适用场景与选型建议

reelflow/reelflow-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.27k 次下载、GitHub Stars 达 6, 最近一次更新时间为 2025 年 03 月 11 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 reelflow/reelflow-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 reelflow/reelflow-php 我们能提供哪些服务?
定制开发 / 二次开发

基于 reelflow/reelflow-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 6
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-03-11