PHPackages                             gatioo/yotpo - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. gatioo/yotpo

ActiveLibrary[HTTP &amp; Networking](/categories/http)

gatioo/yotpo
============

A PHP interface to the YOTPO API, with few fixes

0.0.1(12y ago)0981MITPHPPHP &gt;=5.3.2

Since May 27Pushed 9y ago1 watchersCompare

[ Source](https://github.com/GaTioo/yotpo-php)[ Packagist](https://packagist.org/packages/gatioo/yotpo)[ Docs](https://www.yotpo.com)[ RSS](/packages/gatioo-yotpo/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (4)Used By (0)

yotpo-php
=========

[](#yotpo-php)

A PHP interface to the YOTPO API

Requirements
------------

[](#requirements)

- YOTPO API requires PHP 5.3.0 (or later).

Installation
------------

[](#installation)

First clone the repository:

```
git clone git@github.com:YotpoLtd/yotpo-php.git

```

Then download and install the composer dependencies:

```
php -r "eval('?>'.file_get_contents('https://getcomposer.org/installer'));"
php composer.phar install

```

Usage
-----

[](#usage)

First [register your application with Yotpo](https://www.yotpo.com/register)Then copy and past the app\_key and secret

```
include "yotpo-php/bootstrap.php";
$ak = "APP_KEY";
$st = "SECRET";
$yotpo = new \Yotpo\Yotpo($ak, $st);
```

That's it, you are ready.

Now lets make some public calls to our api. Public calls only require you to use a valid app\_key.

Creating your first review using the API

```
$yotpo->create_review(array(
      'app_key' => $ak,
      'product_id' => "BLABLA",
      'shop_domain' => "omri.co",
      'product_title' => "pt",
      'product_description' => "pd",
      'product_url' => "http://google.com/?q=myproducturl",
      'product_image_url' => "https://www.google.com/images/srpr/logo4w.png",
      'user_display_name' => "MOSHE5656",
      'user_email' => 'haim@yotpo.com',
      'review_body' => "this is my review body",
      'review_title' => "my review title" ,
      'review_score' => 5
      ));
```

and now lets retrieve all the reviews of our product BLABLA

```
$response = $yotpo->get_product_reviews(array('app_key' => $ak, 'product_id' => "BLABLA"));

echo $response->response->reviews[0]->title;
echo $response->response->reviews[0]->score;
```

getting the bottom line of product BLABLA

```
$response = $yotpo->get_product_bottom_line(array('app_key' => $ak, 'product_id' => "BLABLA"));

echo $response->response->bottomline->average_score;
echo $response->response->bottomline->total_reviews;
```

Now lets try something a little bit more complicated. Lets try to create a purchase.

For that we will need to go through Yotpo authenticaton process, provide an app\_key and secret, and return to get the utoken. The utoken will allow us to make authenticated API calls.

```
// retrieving the utoken - will be valid for 24 hours
$credentials = $yotpo->get_oauth_token();
$utoken = $credentials->access_token;

// first creating the products that are in the order, notice that the key of the product hash is the product_sku
$products = array(
        "BLABLA1" => array(
                'url' => "http://shop.yotpo.com/products/amazing-yotpo-poster",
                'name' => "Yotpo Amazing Poster",
                'image_url' => "http://cdn.shopify.com/s/files/1/0098/1912/products/qa2_medium.png?41",
                'description' => "this is the most awesome poster in the world!",
                'price' => "100"
            )
        );

//now we will create a purchase using this the token we have received in the previous step
$response = $yotpo->create_purchase(array(	'app_key' => $ak,
                                        		'utoken' => $utoken,
                                        		'email' => "trial@yotpo.com",
                                        		'customer_name' => "bob",
                                        		'order_id' => "13444",
                                        		'platform' => "Shopify",
                                        		'order_date' => "2013-05-28",
                                        		'products' => $products,
                                        		'currency_iso' => "USD"
                                        		));

```

We can pull all the purchases of a certain account to make sure that the previous calls has worked

```
$response = $yotpo->get_purchases(array('app_key' => $ak, 'utoken' => $utoken, 'since_date' => "2013-05-26"));
echo $response->response->total_purchases;
```

Contributing
------------

[](#contributing)

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

4730d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8153de88dccd5b4a9df01f944fb99e83a59cdfa1c6e45a080c6151618f068e34?d=identicon)[GaTio](/maintainers/GaTio)

---

Top Contributors

[![lsolesen](https://avatars.githubusercontent.com/u/148026?v=4)](https://github.com/lsolesen "lsolesen (4 commits)")[![GaTioo](https://avatars.githubusercontent.com/u/12647782?v=4)](https://github.com/GaTioo "GaTioo (2 commits)")[![vladshub](https://avatars.githubusercontent.com/u/1196390?v=4)](https://github.com/vladshub "vladshub (2 commits)")[![alonbr](https://avatars.githubusercontent.com/u/2698415?v=4)](https://github.com/alonbr "alonbr (1 commits)")[![omrico1](https://avatars.githubusercontent.com/u/519767?v=4)](https://github.com/omrico1 "omrico1 (1 commits)")

---

Tags

restyotpo

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/gatioo-yotpo/health.svg)

```
[![Health](https://phpackages.com/badges/gatioo-yotpo/health.svg)](https://phpackages.com/packages/gatioo-yotpo)
```

###  Alternatives

[zircote/swagger-php

Generate interactive documentation for your RESTful API using PHP attributes (preferred) or PHPDoc annotations

5.3k132.9M468](/packages/zircote-swagger-php)[psr/link

Common interfaces for HTTP links

2.5k144.1M69](/packages/psr-link)[league/fractal

Handle the output of complex data structures ready for API output.

3.5k64.1M471](/packages/league-fractal)[friendsofsymfony/rest-bundle

This Bundle provides various tools to rapidly develop RESTful API's with Symfony

2.8k73.3M317](/packages/friendsofsymfony-rest-bundle)[lexik/jwt-authentication-bundle

This bundle provides JWT authentication for your Symfony REST API

2.6k58.7M210](/packages/lexik-jwt-authentication-bundle)[nelmio/api-doc-bundle

Generates documentation for your REST API from attributes

2.3k63.6M232](/packages/nelmio-api-doc-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
