michaelgarrez/twitch-alerts-sdk
Composer 安装命令:
composer require michaelgarrez/twitch-alerts-sdk
包简介
Twitch Alerts SDK
README 文档
README
Introduction
This library eases the use of the Twitch Alerts API. The current version is built to work with the v1.0 of Twitch Alerts API.
How to use
You first have to register your application with Twitch Alerts, to do this, go on this URL :
Then you can use the API Wrapper knowing your client_id, client_secret and redirect_uri parameters.
Twitch API uses OAuth 2.0 to handle user authentication. This library helps you to handle the authentication process as well.
User Authentication
You will first need to instanciate a Client :
<?php $client = new Client($clientId, $clientSecret, $redirectUri); // $redirectUri should also match exactly the data you entered when you registred your application
You will need to redirect the user to Twitch Alerts when he will accept (or deny) your application to acces his account.
You can ask for multiples scopes. Further you will be limited by the scopes you asked on this step. (The list of the available scopes are available in Client::SCOPES .
<?php $client = new Client($clientId, $clientSecret, $redirectUri); $redirectUrl = $client->getAuthorizeUrl(['donations.create']); // You can pass multiple scopes here // You should then need to redirect the user to this URI. // When the user will return to your redirect_uri either the "code" parameter will be present on the query parameters (you will need it for the next step) or an "error" parameter will be present which means the user refused to allow your application to access his account.
When you have the "code" parameter returned from the previous step will be able to ask for an access_token and a refresh_token. The access_token is needed for any further call you make to the API and the refresh_token is needed to refresh your access_token when it will expire.
To generate your first access_token and refresh_token :
<?php $client = new Client($clientId, $clientSecret, $redirectUri); $tokens = $client->getAccessToken($code); // $code is the code returned on the previous step // $tokens will contains multiple keys : "access_token" and "refresh_token".
You can now use other API methods for 3600 seconds, then you will need to refresh your access token :
<?php $client = new Client($clientId, $clientSecret, $redirectUri); $tokens = $client->refreshAccessToken($refreshToken); // $refreshToken is the refreshToken you got from the previous step (or the last refreshAccessToken you did). // $tokens will contains multiple keys : "access_token" and "refresh_token".
michaelgarrez/twitch-alerts-sdk 适用场景与选型建议
michaelgarrez/twitch-alerts-sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 17 次下载、GitHub Stars 达 5, 最近一次更新时间为 2016 年 01 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「alerts」 「twitch」 「twitch alerts」 「twitch sdk」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 michaelgarrez/twitch-alerts-sdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 michaelgarrez/twitch-alerts-sdk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 michaelgarrez/twitch-alerts-sdk 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
TwitchTV API SDK for PHP
Add visual alerts / warnings to Flarum posts
Laravel package for managing session messages and alerts in view responses
Bootstrap alerts
Simple Client for Twitch-Api https://dev.twitch.tv/docs/api/reference
Social Connection Auth Component
统计信息
- 总下载量: 17
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-01-19