mmoravac/openx 问题修复 & 功能扩展

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

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

mmoravac/openx

Composer 安装命令:

composer require mmoravac/openx

包简介

Modern PHP client for working with the OpenX v4 oAuth API

README 文档

README

Uses Guzzle v4.x and the oauth-subscriber plugin.

Installation

php composer.phar require mmoravac/openx

Usage in your code:

// Setup client and login with user
$client = new mmoravac\OpenX($consumerKey, $consumerSecret, $oauthRealm, 'http://ox-ui.example.com/ox/4.0/');
$client->login('user@example.com', 'souper-seekret-password');

// GET /account - for list of accounts
$res = $client->get('account');
var_dump($res->json());

You should see the JSON dumped out for the accounts endpoint. Feel free to make any other requests you want.

Be sure to read the OpenX API v4 Documentation!

Making HTTP Requests

The OpenX client proxies all normal get/post/put/delete, etc. requests through and automatically adds the required Cookie header before sending the request.

// Makes normal request with necessary Cookie header
$res = $client->get('account');

Access to the Guzzle Client

If you need to get the base Guzzle object to make any further requests or modifications, you can:

// Returns the main GuzzleHttp\Client object
$guzzle = $client->getClient();

Please note that if you do this, the required Cookie header will not be attached to your requests automatically, so you will need to do this yourself with $client->getAuthCookie().

Using the Example

Steps to run the provided example.php:

  1. composer install --dev
  2. cp .env.example .env
  3. Edit .env to add oAuth consumer key and secret, user/pass, etc.
  4. Run it: php example.php

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: proprietary
  • 更新时间: 2018-09-10