承接 gacelabs/basic-instagram-feeds 相关项目开发

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

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

gacelabs/basic-instagram-feeds

Composer 安装命令:

composer require gacelabs/basic-instagram-feeds

包简介

Provides Instagram login code and feed collector for Silverstripe

README 文档

README

Silverstripe supported module

A plugin for Silverstripe that request instagram feed information from the Instagram Basic Display API.

Requirements

  • PHP ^7.0 | ^8.2
  • Silverstripe 4.*

Installation

composer require gacelabs/basic-instagram-feeds

Usage

  • Add this lines into your projects _config/app.yml or _config/mysite.yml:
Instagram:
  app_id: 'YOUR-INSTAGRAM-APP-ID'
  app_secret: 'YOUR-INSTAGRAM-APP-SECRET'
  generated_token: 'YOUR-INSTAGRAM-USER-TOKEN'

Get generated_token value: Go to Instagram Basic Display at your Facebook developer site, then navigate to Basic Display > User Token Generator tab add Instagram Test Users then click Generate Token button to get the generated token for that instagram user

If you don't want to add the generated_token value: After installation and applying usage and you don't have the generated_token value, run dev/build then go to CMS Menu Settings > Instagram Tab and click "Connect Account" button to initialized the first access token

  • set own cache file and redirect uri:
Instagram:
  app_id: 'YOUR-INSTAGRAM-APP-ID'
  app_secret: 'YOUR-INSTAGRAM-APP-SECRET'
  cache_file: 'YOUR-CACHE-TXT-FILENAME'
  redirect_uri: 'YOUR-INSTAGRAM-REDIRECT-URI'

NOTE for redirect_uri: Add it on your Instagram Client OAuth Settings Facebook developer site then echo the GET parameter "code" into your redirect uri script to get your access token, please refer to plugin controller

Pull the data

  • In Back-end
$Posts = SiteConfig::current_site_config()->getInstagramPosts();

// or pull it from the cache file 
$Posts = SiteConfig::current_site_config()->getCachedFeed();
  • In Front-end
<%-- Default --%>
<% if $SiteConfig.getInstagramPosts.Count %>
  <% loop $SiteConfig.getInstagramPosts %>
    <%-- code here --%>
  <% end_loop %>
<% end_if %>

<%-- From cache file --%>
<% if $SiteConfig.getCachedFeed.Count %>
  <% loop $SiteConfig.getCachedFeed %>
    <%-- code here --%>
  <% end_loop %>
<% end_if %>

Returned fields

  • ID
  • Username
  • Caption
  • Link
  • Image
  • Timestamp

Re-extending the InstagramSiteConfigExtension Class

  • Updating the result data
namespace Your\NameSpace;

use SilverStripe\ORM\DataExtension;
use SilverStripe\ORM\ArrayList;

class YourAnotherInstagramSiteConfigExtension extends DataExtension
{
  /**
   * Updates the default results.
   * 
   * @param ArrayList $list (assembled result)
   * @param array $data (instagram posts results)
   */
  public function updateInstagramPosts(ArrayList $list, $data)
  {
    // code
  }

  /**
   * Updates the cache results.
   * 
   * @param $cache (parsed result)
   */
  public function updateCachedFeed($cache)
  {
    // code
  }
}

Bugtracker

Bugs are tracked on github.com (plugin issues).

Links

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-09-03