承接 alexok/instagram-sdk-php 相关项目开发

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

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

alexok/instagram-sdk-php

Composer 安装命令:

composer require alexok/instagram-sdk-php

包简介

This is an unofficial SDK for the Instagram Private API in PHP

README 文档

README

Latest Stable Version Latest Unstable Version Total Downloads Daily Downloads

This is an unofficial SDK for the Instagram Private API in PHP

Motivation

I decided to build this because most libraries for the Instagram Private API I have come across aren't OOP based and are difficult to use.

Donations

If you like this project, please consider donating towards my coffee addiction fund, so I can continue to push commits!

  • Paypal Paypal: Donate
  • btc Bitcoin: 1814x9kioBxPDBCQx8oaty7e6Z3DAosucd

Installation

Composer

composer require liamcottle/instagram-sdk-php
require("../vendor/autoload.php");
$instagram = new \Instagram\Instagram();

If you want to test code that is in the master branch, which hasn't been pushed as a release, you can use dev-master.

composer require liamcottle/instagram-sdk-php dev-master

Don't have Composer?

What?! Grab it here: https://getcomposer.org/

Examples

Examples can be seen in the examples folder.

Usage

Login

Read: Session Management, to avoid calling login in each script.

$instagram->login("username", "password");

Timeline Feed

  • $maxId:string (Optional) Used for Pagination
$instagram->getTimelineFeed($maxId);

User Feed

  • $userId:string|User User or User Id to get Feed of
  • $maxId:string (Optional) Used for Pagination
$instagram->getUserFeed($userId, $maxId);

My User Feed

  • $maxId:string (Optional) Used for Pagination
$instagram->getMyUserFeed($maxId);

Liked Feed

  • $maxId:string (Optional) Used for Pagination
$instagram->getLikedFeed($maxId);

Tag Feed

  • $tag:string Tag
  • $maxId:string (Optional) Used for Pagination
$instagram->getTagFeed($tag, $maxId);

Location Feed

  • $locationId:string|Location Location or Location Id to get Feed of
  • $maxId:string (Optional) Used for Pagination
$instagram->getLocationFeed($locationId, $maxId);

User Tags Feed

  • $userId:string|User User of User Id to get Tags Feed of
  • $maxId:string (Optional) Used for Pagination
$instagram->getUserTagsFeed($userId, $maxId);

Like Media

  • $mediaId:string|FeedItem FeedItem or FeedItem Id to Like
$instagram->likeMedia($mediaId);

Unlike Media

  • $mediaId:string|FeedItem FeedItem or FeedItem Id to Unlike
$instagram->unlikeMedia($mediaId);

Delete Media

  • $mediaId:string|FeedItem FeedItem or FeedItem Id to Delete
  • $mediaType:int Media Type (Constants available in DeleteMediaRequest class)
$instagram->deleteMedia($mediaId, $mediaType);

Comment on Media

  • $mediaId:string|FeedItem FeedItem or FeedItem Id to Comment on
  • $comment:string Comment
$instagram->commentOnMedia($mediaId, $comment);

Get Media Comments

  • $mediaId:string|FeedItem FeedItem or FeedItem Id of Media to get Comments from
  • $maxId:string (Optional) Used for Pagination
$instagram->getMediaComments($mediaId, $maxId);

Delete Media Comments

  • $mediaId:string|FeedItem FeedItem or FeedItem Id to Delete Comments from
  • $commentIds:array Comment Ids to Delete
$instagram->deleteCommentsFromMedia($mediaId, $commentIds);

User Info

  • $userId:string|User User or User Id to get Info of
$instagram->getUserInfo($userId);

User Followers

  • $userId:string|User User or User Id to get Followers of
  • $maxId:string (Optional) Used for Pagination
$instagram->getUserFollowers($userId, $maxId);

User Following

  • $userId:string|User User or User Id to get Following of
  • $maxId:string (Optional) Used for Pagination
$instagram->getUserFollowing($userId, $maxId);

GeoMedia

  • $userId:string|User User or User Id to get GeoMedia of
$instagram->getUserMap($userId);

Media Info

  • $mediaId:string|FeedItem FeedItem or FeedItem Id to get Info of
$instagram->getMediaInfo($mediaId);

Current User Account

$instagram->getCurrentUserAccount();

Edit User Profile

  • $firstname:string First Name
  • $email:string Email
  • $phoneNumber:string Phone Number
  • $gender:int Gender (Constants available in User class)
  • $biography:string: Biography
  • $externalUrl:string External Url
$instagram->editUserProfile($firstname, $email, $phoneNumber, $gender, $biography, $externalUrl);

Set Account Public

$instagram->setAccountPublic();

Set Account Private

$instagram->setAccountPrivate();

Show Friendship

  • $userId:string|User User or User Id to show Friendship between
$instagram->showFriendship($userId);

Follow User

  • $userId:string|User User or User Id to Follow
$instagram->followUser($userId);

Unfollow User

  • $userId:string|User User or User Id to Unfollow
$instagram->unfollowUser($userId);

Block User

  • $userId:string|User User or User Id to Block
$instagram->blockUser($userId);

Unblock User

  • $userId:string|User User or User Id to Unblock
$instagram->unblockUser($userId);

Search Tags

  • $query:string Tag to Search for
$instagram->searchTags($query);

Search Users

  • $query:string User to Search for
$instagram->searchUsers($query);

Search Places (Facebook)

  • $query:string Place to Search for
$instagram->searchFacebookPlaces($query);
  • $latitude:string Latitude
  • $longitude:string Longitude
$instagram->searchFacebookPlacesByLocation($latitude, $longitude);

Change Profile Picture

  • $path:string File path of Profile Picture to Upload
$instagram->changeProfilePicture($path);

Remove Profile Picture

$instagram->removeProfilePicture();

Post Photo

  • $path:string File path of Photo to Post
  • $caption:string Caption for this Photo
$instagram->postPhoto($path, $caption);

Edit Media

  • $mediaId:string|FeedItem FeedItem or FeedItem Id to Edit
  • $caption:string Caption for this Media
$instagram->editMedia($mediaId, $caption);

Get User by Username

  • $username:string Username to find User by
$instagram->getUserByUsername($username);

Logout

$instagram->logout();

Session Management

To avoid logging in each time, you can use the saveSession and initFromSavedSession methods.

Script 1:

//Login
$instagram->login("username", "password");

//Serialize the Session into a JSON string
$savedSession = $instagram->saveSession();

//Store $savedSession in Database, or Cookie etc

Script 2:

//Load $savedSession from Database or Cookie etc
$savedSession = ...;

//Init from Saved Session
$instagram->initFromSavedSession($savedSession);

//Session is Restored, do something!
$instagram-> ...;

Extras

Pagination

Some Instagram endpoints return paginated data.

To access the next page of data, you will need to get the next maximum ID from the response object and pass it into the same method as the nextMaxId parameter.

Example:

//Get TimelineFeed
$timelineFeed = $instagram->getTimelineFeed();

//This will be null if there are no more pages.
$nextMaxId = $timelineFeed->getNextMaxId();

//We have another page of Items
if($nextMaxId != null){
	//Get the next page.
	$timelineFeed = $instagram->getTimelineFeed($nextMaxId);
}

Proxy

Use a Proxy between your Server and the Instagram API

$instagram->setProxy("127.0.0.1:8888");

Optional Username/Password Authentication

$instagram->setProxy("127.0.0.1:8888", "proxyUsername", "proxyPassword");

Enable or Disable Peer Verification, for testing with Charles Proxy etc.

$instagram->setVerifyPeer(false);

TODO

  • Inbox
  • Direct Share
  • Recent Activity
  • Register new Accounts
  • Upload and Post Videos

Contributing

If you would like to contribute to this project, please feel free to submit a pull request.

Before you do, take a look at the issues to see if the functionality you want to contribute to is already in development.

License

MIT

Legal

The name "Instagram" is a copyright of Instagram, Inc.

This project is in no way affiliated with, authorized, maintained, sponsored or endorsed by Instagram, Inc or any of its affiliates or subsidiaries.

I, the project owner and creator, am not responsible for any legalities that may arise in the use of this project. Use at your own risk.

alexok/instagram-sdk-php 适用场景与选型建议

alexok/instagram-sdk-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 51 次下载、GitHub Stars 达 1, 最近一次更新时间为 2017 年 06 月 09 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-06-09