innocode-digital/wp-instagram
Composer 安装命令:
composer require innocode-digital/wp-instagram
包简介
Enables Instagram Basic Display API for developers.
README 文档
README
Description
Enables Instagram Basic Display API for developers.
The idea of the plugin is to use Instagram Basic Display PHP API with ability to get access token through WordPress admin panel.
Install
-
Preferable way is to use Composer:
composer require innocode-digital/wp-instagram -
Alternate way is to clone this repo to
wp-content/plugins/:cd wp-content/plugins/ git clone git@github.com:innocode-digital/wp-instagram.git cd wp-instagram/ composer install
Activate WordPress Instagram Basic Display integration with WP-CLI
wp plugin activate wp-instagram or from Plugins page.
Usage
-
Check Facebook Manual on how to create an APP.
-
Add required constants (usually to
wp-config.php):define( 'INSTAGRAM_CLIENT_ID', '' ); define( 'INSTAGRAM_CLIENT_SECRET', '' ); -
Add site auth URL
https://site.com/instagram/auth/to Valid OAuth Redirect URIs in Basic Display. -
Open settings page in WordPress admin panel Settings -> Instagram
/wp-admin/options-general.php?page=innocode-instagram -
Click on Log in button or Log in as another user in case when should change account.
-
Start use Instagram Basic Display PHP API through
innocode_instagram();function e.g.innocode_instagram()->getUserProfile();. -
(optional) Set site deauth REST API endpoint
https://site.com/wp-json/innocode/v1/instagram/deauthin Deauthorize Callback URL in Basic Display.
Notes
If site is a part of Multisite then main site auth URL should be added in Valid OAuth Redirect URIs. So, plugin should be active on all network or at least on the main site additionally.
Plugin adds daily cron job after authorization. So, please be sure cron functionality works. The token tries to update 3 days before the expiration, user profile data updated daily.
Documentation
By default, endpoint auth URL is using instagram as endpoint, but it's possible to
change with constant:
define( 'INNOCODE_INSTAGRAM_ENDPOINT', 'insta' );
App site
If you want to use one APP for all of your sites where Instagram integration is in use and correctly handle deauthorization process then this plugin could be installed additionally on a site which will store user IDs and URLs of sites where these IDs are using, e.g. this could be a site of your company. Then it's needed to set one more constant on all sites with activated plugin.
define( 'INNOCODE_INSTAGRAM_APP_SITE', 'https://app-site.com' );
It's possible to change full auth URL:
add_filter( 'innocode_instagram_redirect_uri', function ( string $url ) {
return $url;
} );
It's possible to change Instagram permission:
add_filter( 'innocode_instagram_scope', function ( array $scope ) {
return $scope; // Default is array containing 'user_profile' and 'user_media'.
} );
It's possible to change state parameter which is sending with auth request:
add_filter( 'innocode_instagram_state', function ( string $state ) {
return $scope; // Default is string in format '$blog_id:$nonce'.
} );
It's possible to change place where endpoint should be added:
add_filter( 'innocode_instagram_endpoint_mask', function ( $mask, $endpoint ) {
return $mask; // Default is EP_ROOT constant.
}, 10, 2 );
innocode-digital/wp-instagram 适用场景与选型建议
innocode-digital/wp-instagram 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.52k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 10 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 innocode-digital/wp-instagram 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 innocode-digital/wp-instagram 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 2.52k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 13
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0
- 更新时间: 2019-10-15