jstolpe/instagram-graph-api-php-sdk
Composer 安装命令:
composer require jstolpe/instagram-graph-api-php-sdk
包简介
Instagram Graph API PHP SDK
README 文档
README
This repository contains the open source PHP SDK that allows you to access the Instagram Graph API from your PHP app.
Installation
Composer
Run this command:
composer require jstolpe/instagram-graph-api-php-sdk
Require the the autoloader.
require_once __DIR__ . '/vendor/autoload.php'; // change path as needed
No Composer
Get the repository
git clone git@github.com:jstolpe/instagram-graph-api-php-sdk.git
Require the custom autoloader.
require_once '/instagram-graph-api-php-sdk/src/instagram/autoload.php'; // change path as needed
Usage
Simple GET example of a user's profile and media posts.
use Instagram\User\BusinessDiscovery; $config = array( // instantiation config params 'user_id' => '<IG_USER_ID>', 'username' => '<USERNAME>', // string of the Instagram account username to get data on 'access_token' => '<ACCESS_TOKEN>', ); // instantiate business discovery for a user $businessDiscovery = new BusinessDiscovery( $config ); // initial business discovery $userBusinessDiscovery = $businessDiscovery->getSelf();
Simple POST example of posting an image to an Instagram account.
use Instagram\User\Media; use Instagram\User\MediaPublish; $config = array( // instantiation config params 'user_id' => '<USER_ID>', 'access_token' => '<ACCESS_TOKEN>', ); // instantiate user media $media = new Media( $config ); $imageContainerParams = array( // container parameters for the image post 'caption' => '<CAPTION>', // caption for the post 'image_url' => '<IMAGE_URL>', // url to the image must be on a public server ); // create image container $imageContainer = $media->create( $imageContainerParams ); // get id of the image container $imageContainerId = $imageContainer['id']; // instantiate media publish $mediaPublish = new MediaPublish( $config ); // post our container with its contents to instagram $publishedPost = $mediaPublish->create( $imageContainerId );
Example of a custom request.
// first we have to instantiate the core Instagram class with our access token $instagram = new Instagram\Instagram( array( 'access_token' => '<ACCESS_TOKEN>' ) ); /** * Here we are making our request to instagram and specify the endpoint along with our custom params. * There is a custom function for get, post, and delete. * $instagram->get() * $instagram->post() * $instagram->delete() * * Here is the skeleton for the customized call. */ $response = $instagram->method( array( 'endpoint' => '/<ENDPOINT>', 'params' => array( // query params key/values must match what IG API is expecting for the endpoint '<KEY>' => '<VALUE>', '<KEY>' => '<VALUE>', // ... ) ) );
Documentation
See the Wiki for the complete documentation.
jstolpe/instagram-graph-api-php-sdk 适用场景与选型建议
jstolpe/instagram-graph-api-php-sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 108.99k 次下载、GitHub Stars 达 138, 最近一次更新时间为 2022 年 05 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「api」 「sdk」 「instagram」 「graph api」 「instagram graph api」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 jstolpe/instagram-graph-api-php-sdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jstolpe/instagram-graph-api-php-sdk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 jstolpe/instagram-graph-api-php-sdk 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A PSR-7 compatible library for making CRUD API endpoints
Alfabank REST API integration
Zero-dependency raw PHP DNS resolver, domain-ownership verification, and intoDNS/MxToolbox-style diagnostics. Queries authoritative nameservers directly over sockets — never trusts the recursive cache for ownership checks.
A lightweight plain-PHP framework for database-backed CRUD APIs.
bughq error tracking - PHP SDK
ABsurge PHP SDK for feature flags and A/B testing
统计信息
- 总下载量: 108.99k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 138
- 点击次数: 20
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-05-27