matiit/wkop
最新稳定版本:0.2.0
Composer 安装命令:
composer require matiit/wkop
包简介
Wykop API client
README 文档
README
Instalation
You'll need to add the package to the require section of your app composer.json file:
"matiit/wkop": "dev-master"
And execute
composer update
Usage
<?php use Wkop\Factory; $client = Factory::get('APP KEY', 'SECRET KEY'); $client->setUserCredentials('USER LOGIN', 'USER ACCOUNT KEY'); $client->logIn(); // Read resources // Resource name, method parameters, api parameters $results = $client->get('stream', ['index'], ['page' => 1]); // Post to resources // Resource name, method parameters, api parameters, post parameters $result = $client->post('entries', ['add'], [], ['body' => "test"]);
Connecting accounts
<?php use Wkop\Factory; $url = Wkop\Helpers::Wkop\Helpers::getConnectUrl('REDIRECT URL', 'APP KEY', 'SECRET KEY'); $client = Factory::get('APP KEY', 'SECRET KEY'); /** * User should be redirected to that link. * He'll be asked to accept permissions and will be able to connect. * After clicking connect, he will be redirected back to your application to the REDIRECT URL * Handling Response is up to you. * Official Wykop documentation about response format: * http://www.wykop.pl/dla-programistow/dokumentacja/#info6_7_5 * * * In result you'll acquire two variables: * User login * User token (also called user key) */ // Here, get those variables. // And use them: $client->setUserCredentials('USER LOGIN', 'USER ACCOUNT KEY'); $client->logIn(); // From this moment, you will be able to make API calls as logged user.
Ideas
Got an improvement idea? Mail me or send PullRequests.
统计信息
- 总下载量: 145
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2014-11-15