luke-nz/phpreddit 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

luke-nz/phpreddit

Composer 安装命令:

composer require luke-nz/phpreddit

包简介

A PHP Reddit API wrapper that doesn't completely suck.

关键字:

README 文档

README

Created simply because nothing else out there worked. Use by requiring in the master dev stream in your composer.json:

require: {
	"luke-nz/phpreddit": "dev-master@dev"
}

then...

composer require luke-nz/phpreddit

OAuth2 Integration

Simply pass in the user you wish to control and your Reddit ID and Reddit Secret:

use LukeNZ\Reddit;

$reddit = new Reddit('username', 'password', 'id', 'key');

Then set your user agent:

$reddit->setUserAgent('My awesome bot!');

Expressive, chainable syntax

Write better code by taking advantage of method chaining to retrieve data:

$reddit->subreddit('spacex')->wikiPage('index');

Extra sugar where available

Semantic mapping of endpoints improves your code's readability:

$reddit->thing('thing_id')->editComment('some new text');

// or

$reddit->thing('thing_id')->editSelfPost('some new text');

Behind the scenes PHPReddit maps both of the above to the same API call (api/editusertext).

Of course, if you would prefer a closer one to one mapping with Reddit's API, the original methods can still be used.

Current Endpoints

Shown below is a list of API endpoints and how they are implemented by phpreddit, with the columns referring to what class the methods can be called from.

API endpoints Reddit Subreddit User Thing
me (/api/v1/me) me
getComment (/{$permalink}.json) getComment
wikiPages (/{$subreddit}/wiki/pages) wikiPages
wikiPage (/{$subreddit}/wiki/page/{$page}) wikiPage
submit (/api/submit) submit
editUserText (/api/editusertext) editComment, editSelfpost, editUserText
setSubredditSticky (/api/set_subreddit_sticky) stickyPost, unstickyPost, setSubredditSticky

Used in upcoming project, eventually will support all endpoints and other features such as appending/prepending, etc.

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-09-19