t14/open-platform-php 问题修复 & 功能扩展

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

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

t14/open-platform-php

Composer 安装命令:

composer require t14/open-platform-php

包简介

PHP library for utzlizing the The Guardian Newspaper's Open Platform

关键字:

README 文档

README

Master Build Status Dev Build Status

#Guardian Open Platform PHP Client

This is a PHP based client library that aims to provide an easy to use option for consuming The Guardian NewsPapers Open Platform API.

#Before you get started Before you get started you need to get an api key which you can obtain here

##Installation Using composer composer require t14/open-platform-php Create a config.yml file like the one below and add your api key.

# Open Platform Config
- host:
  - 'http://content.guardianapis.com'
- apiKey:
  - 'YOUR API KEY HERE'

##Basic Usage Edit the config.yml file and replace the api key with your own. You can choose to use a different YAML config file (see the config section below)

require 'vendor/autoload.php';
use OpenPlatform\Client;

$op = new Client('DIR_OF_CONFIG_FILE/config.yml');

$op->endpoint('search')
   ->filter('politics', 'section')
   ->filter('newest', 'order-by')
   ->searchQuery('latest election news')
   ->getContent()->getBody();

The getContent() returns a Guzzle client object making it possible to chain a different method other than getBody() See Guzzle documentation for more information

The searchQuery('my free text search') method allows you to add a free text search to your query. You also have the option to specify filters and use different endpoints.

##Endpoints You can query a different endpoint by passing the name of the endpoint as a parameter to the endpoint('nameOfEndpoint') method. For example to query the sections endpoint you could do the following

$op->endpoint('sections')
   ->searchQuery('business')
   ->getContent()->getBody();

##Filters You can chain the filter method to the endpoint method and then to its self allowing you to set multiple filters. Each endpoint supports certain filters and an exception will be thrown if you try to use an incompatible filter to to check which filters are supported by which endpoint you can use the content explorer

The filter method takes a query as its first parameter and the name of the filter you want to use as its second parameter. For example if you would like to use the 'search' endpoint and filter your results to only show a single page, ordered by the most recent from the 'politics' section you could do the following;

$op->endpoint('search')
    ->filter('politics', 'section')
    ->filter('newest', 'order-by')
    ->filter(1, 'page')
    ->getContent()->getBody();

##Useful resources This library is largely based on the Open Platform content explorer. You can use it to help you find out which filters are compatible with which endpoints, see what kind of results your queries return and more. open-platform.theguardian.com

##Contributing Please feel free to fork this repo and open a pull request.

t14/open-platform-php 适用场景与选型建议

t14/open-platform-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 27 次下载、GitHub Stars 达 0, 最近一次更新时间为 2015 年 07 月 04 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「openPlatform」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 t14/open-platform-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 t14/open-platform-php 我们能提供哪些服务?
定制开发 / 二次开发

基于 t14/open-platform-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL
  • 更新时间: 2015-07-04