Skip to content

LarsNieuwenhuizen/Trustpilot

Repository files navigation

Code Climate Test Coverage Build Status StyleCI

Trustpilot

PHP library for communication with Trustpilot

Under development

This package is currently being developed (12-04-2017)

This package will first only support the public routes which require access through api key. Later on the private requests will be added with oAuth support.

Functioning calls

  • Business units

    • Get public business unit
    • Get a business unit's reviews
    • Get a business unit's categories
    • Get a business unit's web links
    • Get a list of business units
  • Categories

    • Get category
    • List business units in category
  • Consumers

    • Get a consumer's reviews
    • Get the profile of the consumer
    • Get the profile of the consumer(with #reviews and weblinks)

Example setup

The configuration class with search for a config.yaml file in the root of the project and use those settings by default.

You can also define a different file using the Configuration constructor like this:

$configuration = new Trustpilot\Configuration('path/to/my/config.yaml');

If you've got that file, configuration can be set as such:

TrustPilot:
  baseUrl: 'https://api.trustpilot.com/'
  basePath: 'v1/'
  resultsPerPage: 5
  orderBy: 'createdat.desc'
  apiKey: 'myApiKey'

If you do not have a yaml file the Configuration can be created using the setters. The setters can always be used to override any Configuration property.

$configuration = new \LarsNieuwenhuizen\Trustpilot\Configuration();
$configuration->setBaseUrl('https://api.trustpilot.com/')
    ->setBasePath('v1/')
    ->setDefaultResultsPerPage(5)
    ->setDefaultOrderBy('createdat.desc')
    ->setApiKey('apikey');

$client = new \LarsNieuwenhuizen\Trustpilot\Client($configuration);

$result = $client->businessDataService->getAllBusinessUnits();

Install via composer

$ composer require larsnieuwenhuizen/trustpilot

About

PHP library for communication with Trustpilot

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages