承接 edwinhoksberg/trustpilot-api 相关项目开发

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

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

edwinhoksberg/trustpilot-api

Composer 安装命令:

composer require edwinhoksberg/trustpilot-api

包简介

An simple library for parsing and displaying Trustpilot reviews.

README 文档

README

Software License Total Downloads

This library is a simple class for displaying TrustPilot reviews.

Requires a minimum PHP version of 5.4.

How to install

With composer

Execute this command in your terminal:

composer require edwinhoksberg/trustpilot-api:dev-master

Or add this line to your composer.json:

"require": {
    "edwinhoksberg/trustpilot-api": "dev-master"
}

and run:

composer update

Without composer

Add this line add the top of your php application:

require 'src/TrustPilot.php';

How to use

// Initialize the API
$trustpilot = new \TrustPilot\Api('1234567');
// Show site total score
$trustpilot->getRatingScore(); // Output: 88
// Show site stars
$trustpilot->getRatingStars(); // Output: 4
// Show number of stars for a specific star
$stars = $trustpilot->getReviewStarDistrubution();
echo 'This site has ' . $stars[5] . ' ratings of five stars.'; 

// Output: This site has 27 ratings of five stars. 
// Dump the data from a random review
var_dump(
    $trustpilot->getRandomReview()
);

// Output:
array(10) {
  ["title"]=>
  string(22) "Very good and excellent prices"
  ["content"]=>
  string(22) "Very good and excellent prices, etc..."
  ["name"]=>
  string(21) "John Doe"
  ["url"]=>
  string(58) "http://www.trustpilot.nl/review/www.mysite.nl#1234567"
  ["language"]=>
  string(5) "en-US"
  ["score"]=>
  int(100)
  ["stars"]=>
  int(5)
  ["score_value"]=>
  string(10) "Excellent"
  ["timestamp"]=>
  int(1418866304)
  ["rating_images"]=>
  array(3) {
    ["small"]=>
    string(50) "//s.trustpilot.com/images/tpelements/stars/s/5.png"
    ["medium"]=>
    string(50) "//s.trustpilot.com/images/tpelements/stars/m/5.png"
    ["large"]=>
    string(50) "//s.trustpilot.com/images/tpelements/stars/l/5.png"
  }
}
// Display all reviews
var_dump(
    $trustpilot->getAllReviews()
);

// Output:
array(1) {
  [0]=>
  array(10) {
    ["title"]=>
    string(22) "Very good and excellent prices"
    ["content"]=>
    string(22) "Very good and excellent prices, etc..."
    ["name"]=>
    string(21) "John Doe"
    ["url"]=>
    string(58) "http://www.trustpilot.nl/review/www.mysite.nl#1234567"
    ["language"]=>
    string(5) "en-US"
    ["score"]=>
    int(100)
    ["stars"]=>
    int(5)
    ["score_value"]=>
    string(10) "Excellent"
    ["timestamp"]=>
    int(1418866304)
    ["rating_images"]=>
    array(3) {
      ["small"]=>
      string(50) "//s.trustpilot.com/images/tpelements/stars/s/5.png"
      ["medium"]=>
      string(50) "//s.trustpilot.com/images/tpelements/stars/m/5.png"
      ["large"]=>
      string(50) "//s.trustpilot.com/images/tpelements/stars/l/5.png"
    }
  }
  [1]=>
  ...
  [2]=>
  ...
}

统计信息

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

GitHub 信息

  • Stars: 5
  • Watchers: 2
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-01-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固