Download the PHP package toin0u/trustpilot without Composer
On this page you can find all versions of the php package toin0u/trustpilot. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download toin0u/trustpilot
More information about toin0u/trustpilot
Files in toin0u/trustpilot
Package trustpilot
Short Description Trustpilot wrapper PHP 5.3+ library
License MIT
Homepage https://github.com/toin0u/Trustpilot
Informations about the package trustpilot
Trustpilot
Please note that the JSON feed has been discontinued
This PHP 5.3+ library helps you to interact with the Trustpilot Developer Feed.
Installation
This library can be found on Packagist. The recommended way to install this is through composer.
Run these commands to install composer, the library and its dependencies:
Now you can add the autoloader, and you will have access to the library:
If you don't use neither Composer nor a ClassLoader in your application, just require the provided autoloader:
Usage
First of all, you can set up a cache object which will cache your feed. There is no default cache and currently
there is only \Trustpilot\Cache\File
. You can provide your own cache by implementing
\Trustpilot\Cache\CacheInterface
.
- File cache (you need to install Symfony Finder and Filesystem components)
File($cacheTimeLimit = self::CACHE_TIME_LIMIT, $temporaryFolderName = self::TEMPORARY_FOLDER_NAME)
$cacheTimeLimit
must be something that strtotime() is able to parse, '> now - 3 hours' is set by default.$temporaryFolderName
must be a string, 'trustpilot' is set by default.
You need an HttpAdapter
which is responsible to get data from Trustpilot Feed.
You can provide your own adapter by implementing HttpAdapter\HttpAdapterInterface
.
You will get someting like:
API
Trustpilot
getDomainName()
: The name of the domain. E.g. "demoshop.com".getLastUpdate()
: The time this feed was generated which is aTrustpilot\Time\Time
object.getUrl()
: The url for the review page of this domain on Trustpilot.getTotalReviews()
: The total number of reviews of this domain,integer
.getDistributionOverStars()
: An arraygetReviews()
: A list of up to 10 reviews of this domain. These reviews are selected by:- The reviews that the administrator of the domain have selected for the feed
- Select from the remaining reviews, order by rating descending, then by date descending
- It's an array of
Trustpilot\Review\Review
objects.
getCategories()
: The categories of this domain.- May contain zero to multiple elements.
- It's an array of
Trustpilot\Category\Category
objects.
getTrustScore()
: The score of this domain which is aTrustpilot\TrustScore\TrustScore
object.
Category
getName()
: The name of the category localized to the language of the domain.getPosition()
: The position in the category,integer
.getTotalDomain()
: The amount of domains in the category,integer
.getImageUrl($size = 'i100')
: The image in different sizes and can be found with the argument,i100
,i120
,i140
,i180
,i220
andi280
for the six different pixel sizes.
Time
getDateTime()
: The\DateTime
object.getHuman()
: A human readable representation of the time localized to the language of the domain. E.g.4 October 2011 10:16:52 GMT
getUnixTime()
: The number of seconds since January 1st, 1970 to this time,integer
.getHumanDate()
: A human readable representation of the date part of the time localized to the language of the domain. E.g. `15. Oct
TrustScore
getScore()
: A score from 0 to 100,integer
.getStars()
: A number of start from 1 to 5,integer
.getReadableScore()
: A description of the score, localized to the language of the domain. E.g.Excellent
orGood
.getImageUrl($size = 'small')
: The image that shows the number of stars. It comes in three different sizes which can be found on the argumentssmall
,medium
, andlarge
.
User
getName()
: The name of the user.getCity()
: The city of the user if any, null otherwise.getLocale()
: The locale or culture of the user. E.g. "en-GB" for British.getTotalReviews()
: The total number of reviews written by this user,integer
.isVerified()
: True if the user is verified, false otherwise.hasImage()
: True if the user have a profile image, false otherwise.getImageUrl($size = 'i24')
: The image url of the profile image. If the user does not have a profile picture, the url will point to a default profile image. The sizes can be found on these arguments:i24
,i35
,i64
andi73
.
Review
getTime()
: The creation date of the review which is aTrustpilot\Time\Time
object.getTitle()
: The title of the review.getContent()
: The main content of the review.getTrustScore()
: TheTrustpilot\TrustScore\TrustScore
object.getCompanyReply()
: The company reply of this review if any, null otherwise.getUser()
: The author of the review which is aTrustpilot\User\User
object.getUrl()
: The url to the review.isVerified()
: True if this review is verified, false otherwise.
Unit Tests
To run unit tests, you'll need cURL
and zlib
extensions and a set of dependencies,
you can install them using Composer:
Once installed, just launch the following command:
Contributing
Please see CONTRIBUTING for details.
Credits
Acknowledgments
Changelog
Support
Please open an issues in github
Contributor Code of Conduct
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
This Code of Conduct is adapted from the Contributor Covenant, version 1.0.0, available at http://contributor-covenant.org/version/1/0/0/
License
Trustpilot is released under the MIT License. See the bundled LICENSE file for details.