Coder Social home page Coder Social logo

php-grab-google-reviews's Introduction

๐Ÿ’ฌ Get Google-Reviews with PHP

This is a tiny but usefull way to grab the 5 most relevant reviews from Google with cURL and with the use of an API Key

How to get the needed Google Places API Key:

How to find the needed Placec ID:

Parameter

$options = array(
  'googlemaps_free_apikey' => '',              // Google API Key
  'google_maps_review_cid' => 'ChIJHegKoJUfyUwRjMxaCcviZDA', // Google Placec ID
  'google_reviews_sorting' => 'most_relevant', // reviews are sorted by relevance (default), or in chronological order (most_relevant/newest)
  'cache_data_xdays_local' => 30,              // every x day the reviews are loaded from google
  'your_language_for_tran' => 'en',            // give you language for auto translate reviews
  'show_not_more_than_max' => 5,               // (0-5) only show first x reviews
  'show_only_if_with_text' => false,           // true = show only reviews that have text
  'show_only_if_greater_x' => 0,               // (0-4) only show reviews with more than x stars
  'sort_reviews_by_a_data' => 'rating',        // sort by 'time' or by 'rating' (newest/best first)
  'show_cname_as_headline' => true,            // true = show customer name as headline
  'show_stars_in_headline' => true,            // true = show customer stars after name in headline
  'show_author_avatar_img' => true,            // true = show the author avatar image (rounded)
  'show_blank_star_till_5' => true,            // false = don't show always 5 stars e.g. โญโญโญโ˜†โ˜†
  'show_txt_of_the_review' => true,            // true = show the text of each review
  'show_author_of_reviews' => true,            // true = show the author of each review
  'show_age_of_the_review' => true,            // true = show the age of each review
  'dateformat_for_the_age' => 'Y.m.d',         // see https://www.php.net/manual/en/datetime.format.php
  'show_rule_after_review' => true,            // false = don't show <hr> Tag after/before each review
  'add_schemaorg_metadata' => true,            // add schemo.org data to loop back your rating to SERP
);
echo getReviews($options);

HINT: Use .review and .review .avatar in you CSS to style the output

Copyright 2019-2023 Igor Gaffling

php-grab-google-reviews's People

Contributors

gaffling avatar mahotilo avatar besrourms avatar ksym04 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.