承接 samsonos/php_instagram 相关项目开发

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

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

samsonos/php_instagram

Composer 安装命令:

composer require samsonos/php_instagram

包简介

SamsonPHP Instagram module

README 文档

README

Latest Stable Version Build Status Code Coverage Total Downloads Scrutinizer Code Quality Stories in Ready

Configuration

First of all you need to create configuration class which is working thanks to SamsonPHP module/service configuration:

class InstagramConfig extends \samsonphp\config\Entity
{
    public $appId = 'YOUR_CLIENT_ID';

    public $appSecret = 'YOUR_CLIENT_SECRET';
}

Get list of posts by tag

After creating configuration you can using module methods. First method uses Instagram Tag Endpoints API. Used method is listByTag($tag, $params = array()). Here the second parameter defines your request parameters (count, max_tag_id, min_tag_id).

For example you want to get 10 posts by hashtag adventure:

/** @var \samson\instagram\Instagram $instagram Get SamsonPHP Instagram module */
$instagram = m('instagram');

// Define tag
$myTag = 'adventure';

// Get list of posts
$posts = $instagram->listByTag($myTag, array('count' => 10));

Like post

This method uses Instagram Like Endpoints API. For using it you just need to know users access token for your application, and media identifier. Notice, that this method can toggle like status, so if you create this request for already liked media, this media will unliked.

Simple example:

/** @var \samson\instagram\Instagram $instagram Get SamsonPHP Instagram module */
$instagram = m('instagram');

// Define media to like
$myMediaID = '657988443280050001_25025320';

// Get list of posts
$posts = $instagram->likeMedia($myMediaID, 'ACCESS_TOKEN');

Relationships

This method uses Instagram Relationship Endpoints API. You can user relationships using method setUserRelationship($user_id, $access_token, $action = 'follow'). For using this method you need to know user instagram identifier and his access token. The third parameter defines the relationship.

Simple example:

/** @var \samson\instagram\Instagram $instagram Get SamsonPHP Instagram module */
$instagram = m('instagram');

// Define media to like
$user_id = '12345678';

// Get list of posts
$posts = $instagram->setUserRelationship($user_id, 'ACCESS_TOKEN', 'unfollow');

Subscriptions

This method uses Instagram User Subscriptions API. You are able to create subscriptions for updates of your authenticated users. Use method subscribe($object, $aspect, $verify_token, $callback, $object_id = null) for creating it. Read more about the parameters in instagram API [documentation] (https://www.instagram.com/developer/subscriptions/)

Simple example:

/** @var \samson\instagram\Instagram $instagram Get SamsonPHP Instagram module */
$instagram = m('instagram');

// Get list of posts
$posts = $instagram->subscribe('user', 'media', 'VERIFY_TOKEN', 'callback-function');

This module is working using Instagram API

统计信息

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

GitHub 信息

  • Stars: 2
  • Watchers: 3
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: Open
  • 更新时间: 2014-09-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固