承接 gatioo/yotpo 相关项目开发

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

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

gatioo/yotpo

Composer 安装命令:

composer require gatioo/yotpo

包简介

A PHP interface to the YOTPO API, with few fixes

关键字:

README 文档

README

A PHP interface to the YOTPO API

Requirements

  • YOTPO API requires PHP 5.3.0 (or later).

Installation

First clone the repository:

git clone git@github.com:YotpoLtd/yotpo-php.git

Then download and install the composer dependencies:

php -r "eval('?>'.file_get_contents('https://getcomposer.org/installer'));"
php composer.phar install

Usage

First register your application with Yotpo Then copy and past the app_key and secret

include "yotpo-php/bootstrap.php";
$ak = "APP_KEY";
$st = "SECRET";
$yotpo = new \Yotpo\Yotpo($ak, $st);

That's it, you are ready.

Now lets make some public calls to our api. Public calls only require you to use a valid app_key.

Creating your first review using the API

$yotpo->create_review(array(
      'app_key' => $ak, 
      'product_id' => "BLABLA", 
      'shop_domain' => "omri.co", 
      'product_title' => "pt", 
      'product_description' => "pd", 
      'product_url' => "http://google.com/?q=myproducturl", 
      'product_image_url' => "https://www.google.com/images/srpr/logo4w.png", 
      'user_display_name' => "MOSHE5656", 
      'user_email' => 'haim@yotpo.com', 
      'review_body' => "this is my review body", 
      'review_title' => "my review title" , 
      'review_score' => 5  
      ));

and now lets retrieve all the reviews of our product BLABLA

$response = $yotpo->get_product_reviews(array('app_key' => $ak, 'product_id' => "BLABLA"));

echo $response->response->reviews[0]->title;
echo $response->response->reviews[0]->score;

getting the bottom line of product BLABLA

$response = $yotpo->get_product_bottom_line(array('app_key' => $ak, 'product_id' => "BLABLA"));

echo $response->response->bottomline->average_score;
echo $response->response->bottomline->total_reviews;

Now lets try something a little bit more complicated. Lets try to create a purchase.

For that we will need to go through Yotpo authenticaton process, provide an app_key and secret, and return to get the utoken. The utoken will allow us to make authenticated API calls.

// retrieving the utoken - will be valid for 24 hours
$credentials = $yotpo->get_oauth_token();
$utoken = $credentials->access_token;

// first creating the products that are in the order, notice that the key of the product hash is the product_sku
$products = array(
        "BLABLA1" => array(
                'url' => "http://shop.yotpo.com/products/amazing-yotpo-poster", 
                'name' => "Yotpo Amazing Poster", 
                'image_url' => "http://cdn.shopify.com/s/files/1/0098/1912/products/qa2_medium.png?41", 
                'description' => "this is the most awesome poster in the world!", 
                'price' => "100"
            )
        );


//now we will create a purchase using this the token we have received in the previous step
$response = $yotpo->create_purchase(array(	'app_key' => $ak, 
                                        		'utoken' => $utoken, 
                                        		'email' => "trial@yotpo.com", 
                                        		'customer_name' => "bob", 
                                        		'order_id' => "13444", 
                                        		'platform' => "Shopify", 
                                        		'order_date' => "2013-05-28", 
                                        		'products' => $products, 
                                        		'currency_iso' => "USD"
                                        		));

                                        

We can pull all the purchases of a certain account to make sure that the previous calls has worked

$response = $yotpo->get_purchases(array('app_key' => $ak, 'utoken' => $utoken, 'since_date' => "2013-05-26"));
echo $response->response->total_purchases;

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

gatioo/yotpo 适用场景与选型建议

gatioo/yotpo 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 981 次下载、GitHub Stars 达 0, 最近一次更新时间为 2017 年 03 月 22 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「rest」 「yotpo」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 gatioo/yotpo 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 gatioo/yotpo 我们能提供哪些服务?
定制开发 / 二次开发

基于 gatioo/yotpo 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-03-22