承接 simplaex/yieldoptimizer 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

simplaex/yieldoptimizer

Composer 安装命令:

composer require simplaex/yieldoptimizer

包简介

Optimize auction/bidrequests using rivrs php library supported by rust server

关键字:

README 文档

README

A simple wrapper to easily construct RivrRequests, optimize them and get a RivrResponse.

Simply run the rivr-server locally or test against rivr-as-a-service.

Basic usage

<?php

use Simplaex\Yieldoptimizer\Model\RivrRequest;
use Simplaex\Yieldoptimizer\Client\RivrHttpClient;

$client = new RivrHttpClient();             // You can reuse the client for as many requests as you like
$request = RivrRequest::createBuilder()
    ->appOrSite("App or Site")
    ->userId("userid-xyz")
    ->browser("choose")
    ->additionalProperty("random-key", "foobar")
    ->additionalProperty("dataCentre", "us-east-1")
    ->build();


$response = $client->optimize($request);

if ($response->requiresClientAction()) {
    print_r($response->getBidderIds());
    echo "do sth with dsps\n";
} else {
    echo "continue with your regular flow\n";
}

Debugging + Logging

By default rivr will not emit any logs using the client. In order to debug potential issues, you simply provide your prefered logger that implements the Psr\Log\LoggerInterface, define your desired log-level and the client will emit logs.

<?php

use Monolog\Handler\ErrorLogHandler;
use Monolog\Logger;
use Simplaex\Yieldoptimizer\Logging\LoggingMiddleware;
use Simplaex\Yieldoptimizer\Client\RivrHttpClient;

$logger = new Logger('Rivr');
$logger->pushHandler(new ErrorLogHandler(ErrorLogHandler::OPERATING_SYSTEM, Logger::INFO));

LoggingMiddleware::initLogger($logger);
$client = new RivrHttpClient();

// When running will emit something like:
[2021-05-26T15:56:30.298900+02:00] Rivr.INFO: Timeout set to 5 ms. [] []
[2021-05-26T15:56:30.300092+02:00] Rivr.INFO: Autoconfig done. Sending all requests to localhost:7487/v1/optimize [] []

Configuration Options

A number of environment variables are available to alter the behavior of the validator.

FlagDescription
RIVR_SERVER_ENDPOINTendpoint to send request to, defaults to localhost:7487
RIVR_REMOTE_AUTH_TOKENwhen using a different endpoint, credentials might be necessary
RIVR_RESPONSE_TIMEOUTamount of time in ms to wait for a response, defaults to 5ms but change to >500ms when testing with rivr-as-a-service

For more information about the whole ecosystem refer to the complete integration guide.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-05-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固