c2is / socialwall-bundle
将 C2iS 社交墙组件集成到 Symfony2 的包
v1.0
2015-07-17 09:00 UTC
Requires
- c2is/socialwall: ~1.0
This package is auto-updated.
Last update: 2024-08-29 04:14:28 UTC
README
安装
使用 composer 安装
composer require c2is/socialwall-bundle dev-master
将包添加到 AppKernel
class AppKernel extends Kernel { public function registerBundles() { $bundles = array( new C2is\Bundle\SocialWallBundle\C2isSocialWallBundle(), ); return $bundles; } }
配置参考
c2is_social_wall: social_networks: facebook: # Used to fetch posts and number of followers of a specific user user_id: ~ # Required limit: 50 api: api_key: ~ # Required api_secret: ~ twitter: # Used to fetch posts with the given tags tags: [] # Used to fetch tweets from a specific user user: ~ # Used to fetch number of tweets and number of followers of a specific user user_id: ~ limit: 50 api: api_key: ~ # Required api_secret: ~ flickr: # Used to fetch posts with the given tags tags: [] # Used to fetch posts number of followers of a specific user user_id: ~ limit: 50 api: api_key: ~ # Required api_secret: ~ instagram: # Used to fetch posts with the given tag tag: ~ # Used to fetch posts number of followers of a specific user user_id: ~ limit: 50 api: api_key: ~ # Required api_secret: ~ google_plus: # Used to fetch posts number of followers of a specific user user_id: ~ # Required limit: 50 api: api_key: ~ # Required api_secret: ~ youtube: # Used to fetch posts number of followers of a specific user channel_id: ~ # Used to fetch posts number of followers of a specific playlist playlist_id: ~ limit: 50 api: api_key: ~ # Required api_secret: ~ cache: duration: '3600'
使用方法
此包提供了一个服务,该服务提供了访问社交墙组件的帮助方法
class MyController { public function myAction() { $socialWall = $this->get('c2is.social_wall.manager'); /* Those methods will throw an exception if the social network is not properly configured */ $twitterItems = $socialWall->getTwitterItemsForUser($overrideUser /* if omitted, uses the user_id defined in the configuration */,, $overrideLimit /* if omitted, uses the limit defined in the configuration */,); $twitterItems = $socialWall->getTwitterItemsForTags($overrideTags /* if omitted, uses the tags defined in the configuration */, $overrideLimit /* if omitted, uses the limit defined in the configuration */); } }
可用方法
- getFacebookItems($userId = null, $limit = null) 如果省略了 userId 或 limit,则使用配置中定义的值。返回用户 $userId 的时间线中的 $limit 条帖子。
- getFacebookNumberOfSubscribers($userId = null) 如果省略了 userId,则使用配置中定义的值。返回喜欢用户 $userId 的 Facebook 页面的人数。
可用方法
- getTwitterItemsForUser($userId = null, $limit = null) 如果省略了 userId 或 limit,则使用配置中定义的值。返回用户 $userId 的 $limit 条推文。
- getTwitterItemsForTags(array $tags = null, $limit = null) 如果省略了 tags 或 limit,则使用配置中定义的值。返回至少包含一个 tags 标签的 $limit 条推文。
- getTwitterNumberOfItems($userId = null) 如果省略了 userId,则使用配置中定义的值。返回用户 $userId 发表的推文数量。
- getTwitterNumberOfSubscribers($userId = null) 如果省略了 userId,则使用配置中定义的值。返回关注用户 $userId 的人数。
Flickr
可用方法
- getFlickrItemsForUser($userId = null, $limit = null) 如果省略了 userId 或 limit,则使用配置中定义的值。返回用户 $userId 发布的 $limit 张 flickr 图片。
- getFlickrItemsForTags(array $tags = null, $limit = null) 如果省略了 tags 或 limit,则使用配置中定义的值。返回至少包含一个 tags 标签的 $limit 张 flickr 图片。
- getFlickrNumberOfItems($userId = null) 如果省略了 userId,则使用配置中定义的值。返回用户 $userId 发布的 flickr 图片数量。
可用方法
- getInstagramItemsForUser($userId = null, $limit = null) 如果省略了 userId 或 limit,则使用配置中定义的值。返回用户 $userId 的 $limit 条 Instagram 帖子。
- getInstagramItemsForTags(array $tags = null, $limit = null) 如果省略了 tags 或 limit,则使用配置中定义的值。返回至少包含一个 tags 标签的 $limit 条 Instagram 帖子。
- getInstagramNumberOfItems($userId = null) 如果省略了 userId,则使用配置中定义的值。返回用户 $userId 发布的 Instagram 图片数量。
- getInstagramNumberOfSubscribers($userId = null) 如果省略了 userId,则使用配置中定义的值。返回关注用户 $userId 的人数。
Google Plus
可用方法
- getGooglePlusItems($userId = null, $limit = null) 如果省略了 userId 或 limit,则使用配置中定义的值。返回用户 $userId 的时间线中的 $limit 条 Google Plus 帖子。
- getGooglePlusNumberOfSubscribers($userId = null) 如果省略了 userId,则使用配置中定义的值。返回将用户 $userId 添加到他们圈子中的人数。
Youtube
可用方法
- getYoutubeItemsForChannel($channelId = null, $limit = null) 如果省略了 channelId 或 limit,则使用配置中定义的值。返回 $channelId 频道的 $limit 个视频。
- getYoutubeItemsForPlaylist($playlistId = null, $limit = null) 如果省略了 playlistId 或 limit,则使用配置中定义的值。返回 $playlistId 播单中的 $limit 个视频。
- getYoutubeNumberOfSubscribers($userId = null) 如果省略userId,则使用配置中定义的值。返回用户$userId的视频观看次数。