openpublicmedia/pbs-tv-schedules-service-php
Composer 安装命令:
composer require openpublicmedia/pbs-tv-schedules-service-php
包简介
PHP client for consuming the PBS TV Schedules Service (TVSS) API.
README 文档
README
This library abstracts interactions with the PBS TV Schedules Service API.
Installation
Install via composer:
composer require openpublicmedia/pbs-tv-schedules-service-php
Use
The primary class provided by this library is the
OpenPublicMedia\PbsTvSchedulesService\Client. A Client instance can be used
to query the API's endpoints for schedule data.
Examples
Creating a client
use OpenPublicMedia\PbsTvSchedulesService\Client; $api_key = 'xxxxxxxxxxxxxx'; $call_sign = 'xxxx'; $client = new Client($api_key, $call_sign);
The $api_key and $call_sign parameters are optional, as not all endpoints
require them.
Getting listings for a day.
$today = new DateTime(); $results = $client->getListings($today); var_dump(reset($results)); class stdClass#45 (4) { public $cid => string(36) "6ecdcaa4-a42d-4360-88a0-90131287f9ef" public $external_id => string(6) "110268" public $short_name => string(7) "KCTSDT4" public $full_name => string(10) "KCTS World" public $timezone => string(19) "America/Los_Angeles" public $listings => array(20) { ... } public $analog_channel => string(1) "9" public $digital_channel => string(3) "9.4" }
Listings are returned in and organized by channel. Each object in the array
contains a $listings property with listings data.
Getting listings with images.
$today = new DateTime(); $results = $client->getListings($today, false, true); var_dump($results[0]->listings[0]); class stdClass#41 (25) { [...] public $images => array(19) { [0] => class stdClass#33 (8) { public $type => string(10) "image/jpeg" public $image => string(84) "https://image.pbs.org/gracenote/pbsd.tmsimg.com/assets/p7879062_n183662_cc_v9_aa.jpg" public $ratio => string(3) "3:4" public $width => string(4) "1080" public $height => string(4) "1440" public $caption => string(10) "Ray Suarez" public $updated_at => string(20) "2012-12-12T00:00:00Z" public $external_profile => string(17) "Cast in Character" } [1] => class stdClass#34 (8) { public $type => string(10) "image/jpeg" public $image => string(84) "https://image.pbs.org/gracenote/pbsd.tmsimg.com/assets/p7879062_n191589_cc_v9_ab.jpg" public $ratio => string(3) "3:4" public $width => string(4) "1080" public $height => string(4) "1440" public $caption => string(10) "Gwen Ifill" public $updated_at => string(20) "2013-09-04T21:02:00Z" public $external_profile => string(17) "Cast in Character" } [...] } [...] }
Searching listings data.
$results = $client->search('jamestown'); var_dump($results); class stdClass#31 (2) { public $program_results => array(2) { ... } public $show_results => array(5) { ... } }
Search results are organized in $program_results and $show_results. Utility
methods are provided to filter this results (searchPrograms, searchShows).
Development goals
See CONTRIBUTING for information about contributing to this project.
v1
- API authentication (
OpenPublicMedia\PbsTvSchedulesService\Client) - API direct querying (
$client->get()) - Result/error handling
- GET wrappers for endpoints (
$client->getXXX()) - Search endpoints support (
$client->search())
v2
- PHP 8 support
v3.x
- Create entities for response data
- Channel (???)
- Listing
- Image
- Swap "kids only" and "fetch images" parameters where appropriate
openpublicmedia/pbs-tv-schedules-service-php 适用场景与选型建议
openpublicmedia/pbs-tv-schedules-service-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.4k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 07 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 openpublicmedia/pbs-tv-schedules-service-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 openpublicmedia/pbs-tv-schedules-service-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 2.4k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2019-07-15