jacob-ian/instagram-feed
Composer 安装命令:
composer require jacob-ian/instagram-feed
包简介
A simple Instagram feed using the old Instagram API
关键字:
README 文档
README
An Instagram Feed using the old API. It will cache the post data in your webserver and use a MYSQL database to store the metadata to maximise loading speeds.
Requirements:
- An Instagram Access Token connected to the desired account to display. Note: The account must be public.
- PHP 7.2+
Usage:
-
Include this repository in your project via Composer (jacob-ian/instagram-feed).
-
Create a MYSQL Database to hold the data:
CREATE DATABASE instagram
The
\JacobIan\InstagramFeed\instagramFetchclass will automatically create the table and populate it. -
Setup a cron-job that will point to a PHP file containing:
require_once('instagram-feed/src/instagramFetch.class.php'); $instagramData = new \JacobIan\InstagramFeed\instagramFetch($database, $accesstoken, $cachepath); $instagramData->fetch();
The
require_once()can be replaced with an autoloader.Where:
-
$databaseshould be an array with the structure:$database = array( "username"=>"[username]", "password"=>"[password]", "host"=>"[host]", "database"=>"instagram" );
-
$accesstokenis a string containing the Instagram Access Token relating to the account you wish to display. -
$cachepathshould be a string with the path to a location in the public_html/webroot directory where you wish the Instagram Cache and Assets to be stored.
This cron job should run every 15 minutes, but frequency can be increased depending on how often you wish the feed to refresh.
-
-
To create the feed itself, use the following code on your PHP webpage:
require_once('instagram-feed/src/instagramFeed.class.php'); $instagram_feed = new \JacobIan\InstagramFeed\instagramFeed($database, $count, $style); echo $instagram_feed->feed();
Again, the
require_once()can be replaced by an autoloader.Where:
$countis an integer describing the number of latest posts to display in the feed. Instagram API is limited to a maximum of 20 posts.$styleis a string containing the desired CSS Style tags on each Instagram Post. See CSS Styles below.
-
Include the following two lines of code to the
<head>of the webpage containing the Instagram Feed:<link rel="stylesheet" type="text/css" href="https://min.gitcdn.xyz/repo/jacob-ian/instagram-feed/master/css/feed.css"/> <script src="https://min.gitcdn.xyz/repo/jacob-ian/instagram-feed/master/js/feed.js"></script>
-
Enjoy!
CSS Styles:
The available CSS tags are:
Size:
-
'small': Grid size of 150x150px with a frame around the media -
'medium': Grid size of 300x300px with a frame around the media -
'large': Grid size of 640x640px with a frame around the media -
'small_noframe': Grid size of 150x150px without a frame -
'medium_noframe': Grid size of 300x300px without a frame -
'large_noframe': Grid size of 640x640px without a frame
Color:
'dark': Sets post background-color to#333(dark-grey)'transparent': Sets post background-color to transparent'noborder': Removes the border on the posts- Note: the default background-color is
#fff(white).
Spacing:
'nomargin': Removes the gap between the posts in the Instagram Feed grid.
Example Styles:
'small dark': A small grid size with a frame of colour #333 around the media'large_noframe nomargin noborder': A large grid size without a frame and no gaps between the posts. This setup makes it easy to use the Masonry JS Script.
Usage:
- Only one Size tag can be used, and it is also the minimum requirement for the feed to work.
- After the size tag, the other tags can be added on with a space in between.
Custom Styles:
- Custom Styles can be used by adding them to the
$stylestring with a space. - To use a custom size style, the size tag can be replaced by a custom string. This will then be converted to the CSS tag
post_[custom]andmedia_[custom].
Notes:
- The
\JacobIan\InstagramFeed\instagramFetchclass automatically transfers the contents of'..\assets'to the cache folder that is publicly accessable. \JacobIan\InstagramFeed\instagramFetchcreates a database table named 'details' which contains the following information:- UserID: Instagram User ID
- ProfilePictureURL: The URL to your profile picture
- ProfilePicturePath: The path to the locally stored copy of your profile picture
- Followers: Your follower count
- Posts: Your post count
- LastUpdate: The time of the last successful instagramFetch cron job.
- CachePath: The path where your Instagram Cache and Assets are stored.
jacob-ian/instagram-feed 适用场景与选型建议
jacob-ian/instagram-feed 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7 次下载、GitHub Stars 达 1, 最近一次更新时间为 2018 年 06 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「feed」 「instagram」 「jacob-ian」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 jacob-ian/instagram-feed 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jacob-ian/instagram-feed 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 jacob-ian/instagram-feed 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Handles basic OAuth/OAuth2 authentication along with classes for common services
Craft CMS plugin to receive Instagram feed data as variable in templates.
Simple Sharing generates social media share links within CP entry pages, allowing you to quickly & easily share entries.
Simple RSS generator library for PHP 5.5 or later. clone from Bhaktaraz Bhatta ttps://github.com/bhaktaraz/php-rss-generator
An easy-to-use PHP Class for accessing Instagram's API.
Laravel package for the simplification and integration of many of your users most wanted login providers. Installation is a breeze. Never worry about OAuth again.
统计信息
- 总下载量: 7
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 7
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2018-06-27