marshmallow / reviews-kiyoh
将Kiyoh连接到您的Laravel应用程序
Requires
- php: ^7.4|^8.0
- marshmallow/helpers: ^2.0
- dev-master
- v1.2.3
- v1.2.2
- v1.2.1
- v1.2.0
- v1.1.0
- v1.0.6
- v1.0.5
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- dev-hotfix/handle-api-1015-exception
- dev-dependabot/github_actions/overtrue/phplint-9.0
- dev-feature/added-job-to-get-kiyoh-reviews
- dev-lucien/mm-9500-kiyoh-reviews-package-aanpassen-jobs-maken-om-reviews-binnen
- dev-dependabot/github_actions/actions/checkout-4
- dev-development
This package is auto-updated.
Last update: 2024-09-26 12:05:01 UTC
README
Laravel Kiyoh 评论
安装
您可以使用composer安装此包。
composer require marshmallow/reviews-kiyoh
配置
要开始使用Kiyoh,您需要发布配置并根据需要进行更新。您需要在config/kiyoh.php中添加hash、location_id和feed_hash。
php artisan vendor:publish --provider="Marshmallow\Reviews\Kiyoh\ServiceProvider"
邀请
use Marshmallow\Reviews\Kiyoh\Facades\KiyohInvite; use Marshmallow\Reviews\Kiyoh\Exceptions\KiyohException; try { KiyohInvite::email('stef@marshmallow.dev') /** * Optional */ ->supplier('Marshmallow') ->firstName('Stef') ->lastName('van Esch') ->refCode('Order: #1001') ->city('Alphen aan den Rijn') ->delayIgnoreWeekend(3) /** * Always end with invite() */ ->invite(); } catch (KiyohException $e) { /** * You should always try-catch this. Kiyoh can * through an error if someone has already received * an invitation. If this is thrown, you don't want * you code to be killed! */ }
聚合信息源
使用信息源非常简单。使用Kiyoh门面来访问数据源。以下列出可用的方法。请注意,默认情况下,Kiyoh的XML源将使用您的默认CACHE_DRIVER进行缓存。缓存时间为1小时。您可以在config/kiyoh.php中更改此设置。如果由于某种原因源不可用,将抛出异常。如果您在blade中使用这些方法,可以在方法前加上dontFail()前缀。如果您使用dontFail(),所有方法都将返回0。
use Marshmallow\Reviews\Kiyoh\Facades\Kiyoh; Kiyoh::feed()->average() Kiyoh::dontFail()->feed()->average();
可用方法
-
Kiyoh::feed()->average()
-
Kiyoh::feed()->count()
-
Kiyoh::feed()->average12months()
-
Kiyoh::feed()->count12months()
-
Kiyoh::feed()->recommendation()
-
Kiyoh::feed()->getAttribute('average')
将评论存储在您的数据库中
如果您希望获取所有评论并将它们存储在您自己的数据库中或对其进行其他操作,您可以使用以下方法获取它们
$reviews = Kiyoh::withoutCache()->feed(); foreach ($reviews as $review) { // Do your own magic here }
产品
php artisan marshmallow:resource KiyohProduct Reviews\Kiyoh
版权(c)2020 marshmallow。
许可证
MIT许可证(MIT)。有关更多信息,请参阅许可证文件。
开发中的测试
php artisan test packages/marshmallow/reviews/kiyoh