marshmallow / reviews-kiyoh
Connect your Kiyoh to your Laravel application
Installs: 4 083
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 2
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-11-26 12:27:25 UTC
README
Laravel Kiyoh Reviews
Installation
You can install this package using composer.
composer require marshmallow/reviews-kiyoh
Setup
To start using Kiyoh you need to publish the config and update the config accordingly. You need to add hash
, location_id
and feed_hash
to config/kiyoh.php
.
php artisan vendor:publish --provider="Marshmallow\Reviews\Kiyoh\ServiceProvider"
Invites
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! */ }
Feed aggregate information
Using feed information is very easy. Use the Kiyoh
facade to access feed data. Available methods are listed below. Please note that by default the XML feed of Kiyoh will be cached using your default CACHE_DRIVER
. The feed will be cached for 1 hour. You can change this in config/kiyoh.php
. If for some reason the feed is unavailable an exeption will be thrown. If you are using these methods in blade you can prefix the methods with dontFail()
. If you use dontFail()
all methods will return 0
.
use Marshmallow\Reviews\Kiyoh\Facades\Kiyoh; Kiyoh::feed()->average() Kiyoh::dontFail()->feed()->average();
Available methods
-
Kiyoh::feed()->average()
-
Kiyoh::feed()->count()
-
Kiyoh::feed()->average12months()
-
Kiyoh::feed()->count12months()
-
Kiyoh::feed()->recommendation()
-
Kiyoh::feed()->getAttribute('average')
Store the reviews in your own database
If you wish to get all the reviews and store them in you own database or do whatever with it, you can get them with the methods below:
$reviews = Kiyoh::withoutCache()->feed(); foreach ($reviews as $review) { // Do your own magic here }
Products
php artisan marshmallow:resource KiyohProduct Reviews\Kiyoh
Copyright (c) 2020 marshmallow.
License
The MIT License (MIT). Please see License File for more information.
Tests during development
php artisan test packages/marshmallow/reviews/kiyoh