承接 yizack/instagram-feed 相关项目开发

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

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

yizack/instagram-feed

Composer 安装命令:

composer require yizack/instagram-feed

包简介

PHP library to retrieve an Instagram profile feed, embed the feed of your authorized Instagram accounts on your website. The library uses the Instagram API with auto-refreshing access token support.

README 文档

README

Packagist

PHP library to retrieve an Instagram profile feed, embed the feed of your authorized Instagram accounts on your website. The library uses the Instagram API with auto-refreshing access token support.

(Live Demo)

Live Demo

Limitations

Requeriments

  • PHP Hosting (with composer, file_get_contents(), file_put_contents() support)
  • Meta Developer App [Guide]
  • Instagram API [Guide]

Installation

To install the library, make sure you have Composer installed and using your command terminal run the following:

composer require yizack/instagram-feed

Use

Installing this library will allow you to use the InstagramFeed class by simply importing the composer autoload.

Import the composer autoload, use the namespace Yizack\InstagramFeed and initialize the InstagramFeed object.

require "vendor/autoload.php";
use Yizack\InstagramFeed;

$feed = new InstagramFeed(
  "long-lived-access-token" // Paste your long-lived-access-token here
);

To retrieve your Instagram feed array use the getFeed() function.

$array = $feed->getFeed();

Or loop it directly in a foreach method wherever you need it.

foreach ($feed->getFeed() as $value) {
    // your code
}

The getFeed() function also accepts an array of fields to be returned.

$array = $feed->getFeed(["username", "permalink", "timestamp", "caption", "media_url"]);

For a list of all available fields see: https://developers.facebook.com/docs/instagram-platform/reference/instagram-media#fields

About the code

InstagramFeed constructor arguments

Argument Type Description Optional Default value
token string Your Instagram long-lived-access-token. No
path string The path where the updated file will be saved on your server. Yes ig_token
filename string The name of the file in which the date of the last token update will be stored. Yes updated.json

getFeed() function

Updates the date of the last token update and requests feed data from an Instagram account.

Returns an array with the data of the last 25 posts with the following data for each one:

Key Description
username Instagram username.
permalink Instagram post permalink.
timestamp Instagram post timestamp.
caption Instagram post caption.
id Instagram post identifier.

Long-Lived Access token

This approach uses Long-Lived Access Tokens obtained by authorizing your Instagram account with your Meta App.

Since Long-lived tokens are valid for 60 days and can be refreshed as long as they are at least 24 hours old and not expired, the getFeed() method will refresh your token everytime it is been called if 24 hours have passed.

Tokens that have not been refreshed in 60 days will expire and can no longer be refreshed, so be sure to visit often the site where you placed the feed.

Example of use

Check the example folder for details.

Requeriments Guide

PHP Hosting

You can use any PHP Hosting unless it does not support file_get_contents() and file_put_contents().

Meta Developer App

In order to use the Instagram API, we must first create a Meta App. Follow the steps below to create a Meta App.

  1. Go to Meta for Developers site, login and create App. Select the app type as Business. Meta App Step 1

  2. Provide your App details. Meta App Step 2

Instagram API

Now it is time to authorize your Instagram Business or Creator account.

  1. Look for Instagram product, and click on Set up to use the Instagram API. Instagram API Step 1

  2. In the Generate access tokens section, Click on the Add account button. Instagram API Step 2

  3. Login using your Instagram Business or Creator account and allow the permissions. Instagram API Step 3

  4. Click on Generate token, allow the permissions, and copy the generated token inside the code. Instagram API Step 4

  5. Paste your token in your code.

Repository

Yizack/instagram-feed on GitHub.

yizack/instagram-feed 适用场景与选型建议

yizack/instagram-feed 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 6.03k 次下载、GitHub Stars 达 121, 最近一次更新时间为 2022 年 09 月 21 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「feed」 「instagram」 「meta」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 121
  • Watchers: 5
  • Forks: 32
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-09-21