ghosh/designernews-php-api 问题修复 & 功能扩展

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

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

ghosh/designernews-php-api

Composer 安装命令:

composer require ghosh/designernews-php-api

包简介

A simple php wrapper for the Designer News API.

README 文档

README

About

A simple php wrapper for the Designer News API.

Requirements

  • PHP 5.3.x or higher
  • cURL
  • A valid Designer News Access Token

oAuth 2

This library assumes that you have already acquired a valid Access Token using your preferred oAuth library.

Please note that as of this writing, the Designer News API only supports ClientCredentials and Password Grant Types.

Getting Started

You can either download the latest version from the repo, or alternatively install it as a dependency with Composer.

Installing with Composer

{
    "require": {
        "ghosh/designernews-php-api": "~1.0"
    }
}

Then run composer.phar install from your command line in your application root folder.

Instantiating the class

$config = array(
	"accessToken"  => "YOUR_ACCESS_TOKEN"
);

try
{
	$DN = new DesignerNews($config);
}
catch (Exception $e)
{
	echo $e->getMessage();
}

This creates a new instance of the Designer News API class and assigns it to the $DN handle. Its recommended to wrap this in a try/catch block to handle any errors that may arise.

Configuration Options

  • accessToken Required - This is the access token which would be provided to you by your oauth library
  • apiVersionSegment Optional - The current api version. Will default to v1
  • userAgent Optional - The user agent for the application. Designer News recommends setting it to your email address so that you can be contacted if any misuse of data is detected. Defaults to designer-news-api-php-wrapper

Available Methods

The wrapper includes convenient methods used to perform HTTP requests on behalf of the authenticated user. Below you will find a list of all available methods.

User

$DN->me();

Stories

$DN->getStory($id);
$DN->upvoteStory($id);
$DN->commentOnStory($id, $comment);
$DN->getTopStories();
$DN->getRecentStories();
$DN->searchForStory($queryString);

Comments

$DN->getComment($id);
$DN->upvoteComment($id);
$DN->replyToComment($id, $reply);

MOTD (Message of the day)

$DN->getMOTD();
$DN->upvoteMOTD();
$DN->downvoteMOTD();

Response Type

All responses from the Designer News API PHP Wrapper are returned as PHP objects.

Feedback and Bugs

Feel free to open a new issue here on github for any bug you may have come across or a feature which you would like added. Pull requests are most welcomed.

History

Designer News 1.0
  • release - Initial Public Release
  • feature - Added Packagist support
Designer News 0.1
  • release - Public Beta Release

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-03-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固