eosvn/a2reviews-client-api

The PHP SDK integrate with A2Reviews Client API system. Development by A2Reviews, Inc.

v1.0.1 2021-09-25 08:33 UTC

This package is auto-updated.

Last update: 2024-04-25 23:21:12 UTC


README

68747470733a2f2f61327265762e636f6d2f5f6e7578742f696d672f663436336466322e737667

Total Downloads Latest Stable Version License Latest Stable Version Latest Unstable Version composer.lock

Overview

A2Reviews Client API lets you build apps, extensions or plugins to get reviews from the A2reviews APP. Including adding reviews to a store's products. It is used to import and export reviews through the API. This is the official package built and developed by A2Reviews, Inc.

Requirements

Installation

Execute the following command to get the package:

composer require eosvn/a2reviews-client-api

Usage

Create an instance of the A2Reviews Client, then used to access the A2Reviews Client API.

<?php

require_once __DIR__ . "/vendor/autoload.php";

$a2Review = new EOSVN\A2ReviewsClient\A2ReviewsClient([
    'api_key' => '{A2Review_API_Key}',
    'api_secret' => '{A2Review_API_Secret}',
]);

Examples

In the examples below we just used some parameters as a demo. For detailed parameters please visit our documentation.

Product Reviews

APIs for reviews of product, allows to get the reviews of a product or all products. Make it possible to deploy on different platforms.

Get product reviews
$response = $a2Review->review->getProductReviews([
    'handle' => '{product_handle}',
    'limit' => 2 // Number record per page
]);
Get feature reviews
$response = $a2Review->review->getFeatureReviews([
    'limit' => 2
]);
Get block list reviews
$response = $a2Review->review->getBlockListReviews([
    'limit' => 2
]);
Get block reviews
$response = $a2Review->review->getBlockReviews([
    'limit' => 2
]);
Write review to product
$response = $a2Review->review->addReviewToProduct([
    'handle' => '{product_handle}',
    'review' => [
        'rating' => 4,
        'title' => 'Package title review.',
        'author' => 'Author name',
        'email' => 'author_email@gmail.com',
        'content' => 'Package content review.'
    ]
]);
Update a review
$response = $a2Review->review->updateReview([
    'id' => '{review_id}',
    'handle' => '{product_handle}',
    'review' => [
        'rating' => 2,
        'title' => 'Package title review (update).',
        'author' => 'Author name',
        'email' => 'author_email@gmail.com',
        'content' => 'Package content review.'
    ]
]);
Update image review
$response = $a2Review->review->updateImageReview([
    'id' => '{review_id}',
    'handle' => '{product_handle}',
    'image' => [
        'attachment' => '{image data base64}',
        'filename' => '{filename}'
    ]
]);

Client Site Settings

APIs for client site, allows to get the settings global, setting languages.

Get global settings
$response = $a2Review->setting->getGlobalSettings();
Get reviews languages
$response = $a2Review->setting->getReviewLanguages();
Get questions answers language
$response = $a2Review->setting->getQuestionAnswerLanguages();
Get common languages
$response = $a2Review->setting->getCommonLanguages();

After request, using below way to get data

$response->getData();

Documentation

A2Reviews - Official Client API Documentation

Changelog

Please see CHANGELOG for more information what has changed recently.

Security

If you discover a security vulnerability within a2reviews-client-api, please send an e-mail to A2Reviews, Inc via info@a2rev.com. All security vulnerabilities will be promptly addressed.

Credits

License

The Laravel framework is open-sourced software licensed under the MIT license.