2017 © Pedro Peláez
 

library trip-advisor

PHP implementation of review API

image

exussum12/trip-advisor

PHP implementation of review API

  • Wednesday, January 24, 2018
  • by exussum
  • Repository
  • 1 Watchers
  • 1 Stars
  • 642 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 5 Versions
  • 13 % Grown

The README.md

Trip Advisor Review Client

Build Status Coverage Status Scrutinizer Code Quality, (*1)

This is designed to be an easy way in php to use the reviews API from TripAdvisor., (*2)

This can be installed using composer for example, (*3)

composer require exussum12/trip-advisor

Then the most simple method of getting the reviews is as follows, (*4)

$reviews = new exussum12\TripAdvisor\Reviews('your key', 'your secret');
foreach ($reviews->get() as $review) {
    //handle review
}

The API is paged at a maximum of 1000 reviews per page, This is all handled transparently and will page internally only requesting new data when it is required., (*5)

You can set the page size by doing $reviews->limit(50); This will request smaller chucks. If you only want a certain size of data use $reviews->get()->getArray() which will only send one request., (*6)

If you are trying to update existing data, use a date range, eg $reviews->since(new DateTime('2017-01-01')), (*7)

This will only return the newer reviews., (*8)

Options

All options can be chained, together for example, (*9)

$reviews->offset(100)->limit(50)->since(new DateTime('2017-01-31'));
foreach ($reviews->get() as $review) {
    //handle review
}

Exceptions

A few things can go wrong in this process, The exceptions are named as well as I can think of, All exceptions extend from exussum12\TripAdvisor\Exceptions\BaseException., (*10)

The reviews which come back are immutable, So trying to write to any review will throw an exception (ImmutableObjectException), (*11)

The Versions

24/01 2018

dev-master

9999999-dev

PHP implementation of review API

  Sources   Download

MIT

The Development Requires

by Scott Dutton

24/01 2018

dev-exussum12-patch-1

dev-exussum12-patch-1

PHP implementation of review API

  Sources   Download

MIT

The Development Requires

by Scott Dutton

09/11 2017

v0.1.2

0.1.2.0

PHP implementation of review API

  Sources   Download

MIT

The Development Requires

by Scott Dutton

05/11 2017

v0.1.1

0.1.1.0

PHP implementation of review API

  Sources   Download

MIT

The Development Requires

by Scott Dutton

03/11 2017

v0.1.0

0.1.0.0

PHP implementation of review API

  Sources   Download

MIT

The Development Requires

by Scott Dutton