PHP code example of madbox-99 / laravel-google-reviews

1. Go to this page and download the library: Download madbox-99/laravel-google-reviews library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

madbox-99 / laravel-google-reviews example snippets


use Illuminate\Support\Facades\Schedule;

Schedule::command('google-reviews:sync')->daily();

use Madbox99\GoogleReviews\Facades\GoogleReviews;

$place = GoogleReviews::for();        // read stored/cached reviews (nullable)
$place = GoogleReviews::refresh();    // fetch fresh from Google and store

$place->name;                // string|null
$place->rating;              // float|null (average)
$place->userRatingsTotal;    // int|null
foreach ($place->reviews as $review) {
    $review->authorName;     // string
    $review->rating;         // int (0-5)
    $review->text;           // string
    $review->publishedAt;    // DateTimeImmutable|null
}

use Madbox99\GoogleReviews\Filament\GoogleReviewsPlugin;

public function panel(Panel $panel): Panel
{
    return $panel->plugin(GoogleReviewsPlugin::make());
}
bash
php artisan vendor:publish --tag=google-reviews-config
bash
php artisan vendor:publish --tag=google-reviews-migrations
php artisan migrate
bash
php artisan vendor:publish --tag=google-reviews-views
bash
php artisan vendor:publish --tag=google-reviews-migrations
php artisan migrate