vergelijkgroep/php-kiyoh-api
最新稳定版本:v1.1
Composer 安装命令:
composer require vergelijkgroep/php-kiyoh-api
包简介
Allows you to interact with KiyOh using PHP
README 文档
README
This is a fork of the (PHP-Kiyoh-API package)[https://github.com/JKetelaar/PHP-Kiyoh-API]. This package adds a timeout param to be passed to the Kiyoh instance. This allows the user to set a max duration of the fetch operation and prevent long response times when Kiyoh api is (partially) down.
How to install?
Install this project using composer: composer require vergelijkgroep/php-kiyoh-api.
Then start using the API using something like:
<?php /** * @author Keuze.nl */ require_once('vendor/autoload.php'); $connector = 'xxxxxxxx'; // Change with your hash $count = 50; // Amount of reviews you want to get $timeout = 2; // Max duration in seconds of the fetch operation $kiyoh = new \keuze\Kiyoh\Kiyoh($connector, $count, $timeout); // Optionally set fallback company information and reviews $kiyoh->setFallbackCompany([ 'averageRating' => 5, 'numberReviews' => 100, 'last12MonthAverageRating' => 5, 'last12MonthNumberReviews' => 100, 'percentageRecommendation' => 100, 'locationId' => 1, 'locationName' => 'Test', 'reviews' => [ [ 'id' => '1', 'reviewAuthor' => 'John Doe', 'city' => 'Amsterdam', 'rating' => 5.0, 'content' => 'Excellent service!', 'dateSince' => '2023-01-01', 'updatedSince' => '2023-01-02', ], [ 'id' => '2', 'reviewAuthor' => 'Jane Smith', 'city' => 'Rotterdam', 'rating' => 4.5, 'content' => '1', 'dateSince' => '2023-02-01', ], [ 'id' => '3', 'reviewAuthor' => 'Alice Johnson', 'rating' => 4.0, 'content' => 'Good service.', ] ] ]); try { $company = $kiyoh->getCompany(); } catch (\Throwable $th) { // Handle errors echo $th->getMessage(); //throw $th; // OR use teh fallback $company = $kiyoh->getFallbackCompany(); } var_dump($company->getReviews()[0]->getId()); var_dump($company->getLocationName()); var_dump($company->getAverageRating()); var_dump($company->getNumberReviews());
Example outputs
Company output
var_dump($kiyoh->getCompany());
Review output
var_dump($kiyoh->getCompany()->getReviews()[0]);
统计信息
- 总下载量: 2.28k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0
- 更新时间: 2024-12-09

