{"id":27370021,"url":"https://github.com/pod-point/reviews-php","last_synced_at":"2025-10-28T17:39:47.633Z","repository":{"id":55885875,"uuid":"290180792","full_name":"Pod-Point/reviews-php","owner":"Pod-Point","description":"A review service for PHP applications.","archived":false,"fork":false,"pushed_at":"2020-12-09T14:23:14.000Z","size":347,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-20T23:08:06.303Z","etag":null,"topics":["software-team"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Pod-Point.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-08-25T10:09:06.000Z","updated_at":"2023-11-09T00:16:21.000Z","dependencies_parsed_at":"2022-08-15T08:40:20.093Z","dependency_job_id":null,"html_url":"https://github.com/Pod-Point/reviews-php","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/Pod-Point/reviews-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pod-Point%2Freviews-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pod-Point%2Freviews-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pod-Point%2Freviews-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pod-Point%2Freviews-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Pod-Point","download_url":"https://codeload.github.com/Pod-Point/reviews-php/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pod-Point%2Freviews-php/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261032113,"owners_count":23100051,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["software-team"],"created_at":"2025-04-13T08:47:43.686Z","updated_at":"2025-10-28T17:39:42.596Z","avatar_url":"https://github.com/Pod-Point.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Reviews\n\n[![Build Status](https://travis-ci.com/Pod-Point/reviews-php.svg?branch=master)](https://travis-ci.com/Pod-Point/reviews-php)\n[![codecov](https://codecov.io/gh/Pod-Point/reviews-php/branch/master/graph/badge.svg)](https://codecov.io/gh/Pod-Point/reviews-php)\n[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%207.1-8892BF.svg?style=flat-square)](https://php.net/)\n\nA reviews service manager for PHP applications. This package provides a shared interface to use different reviews providers.\nList of supported reviews providers:\n * [Trustpilot](https://trustpilot.com)\n * [ReviewsIO](https://reviews.co.uk/)\n\n## Glossary\n\nA review is an evaluation of a publication, product, or company for example. In this package we have a clear differentiation of types of reviews that can be for:\n* `Merchant`: it can be company/business/merchant/service review.\n* `Product`: a product review, meaning it has a clear link to a product.\n\n## Installation\n\n 1. Add the following in the repository section of the composer.json\n```json\n{\n    \"type\": \"git\",\n    \"url\": \"git@github.com:pod-point/reviews-php.git\"\n}\n```\n2. Run the following command inside of the desired project workspace.\n```bash\ncomposer require pod-point/reviews-php\n```\n\n##### Publish the configuration - Laravel\n1. Add the provider to the list of providers on config/app.php\n```php\nPodPoint\\Reviews\\LaravelServiceProvider::class\n\n```\n\n2.\n```php\nphp artisan vendor:publish\n```\n\n## Usage\nThe Reviews class takes an array as the first parameter, see example of config file below:\n```php\nreturn [\n        /*\n        |--------------------------------------------------------------------------\n        | Review provider configurations\n        |--------------------------------------------------------------------------\n        */\n        'reviews_io' =\u003e [\n            'store' =\u003e env('REVIEWS_CO_UK_STORE'),\n            'api_key' =\u003e env('REVIEWS_CO_UK_API_KEY'),\n        ],\n\n        'trustpilot' =\u003e [\n            'username' =\u003e env('TRUSTPILOT_USERNAME'),\n            'password' =\u003e env('TRUSTPILOT_PASSWORD'),\n            'client_secret' =\u003e env('TRUSTPILOT_SECRET_KEY'),\n            'client_id' =\u003e env('TRUSTPILOT_CLIENT_ID'),\n            'business_unit_id' =\u003e env('TRUSTPILOT_BUSINESS_ID'),\n            'invite_reply_to_email' =\u003e env('TRUSTPILOT_INVITE_REPLY_TO_EMAIL'),\n            'invite_redirect_uri' =\u003e env('TRUSTPILOT_INVITE_REDIRECT_URI')\n        ],\n];\n```\n\nThe Trustpilot requires the access token to be cached, in order to ensure you do it when consuming this package ensure you need to set the cache driver.\n\nExample:\n```php\n$cacheAdapter = new \\PodPoint\\Reviews\\Cache\\LaravelCacheAdapter();\n\\PodPoint\\Reviews\\Cache\\CacheProvider::setInstance($cacheAdapter);\n```\n\nAll the providers should respect the same interface.\n\n```php\n$reviews = new \\PodPoint\\Reviews\\Reviews($config);\n$trustpilot = $reviews-\u003etrustpilot();\n```\nLaravel Example:\n```php\n$trustpilot = Reviews::trustpilot();\n```\n\nHere is an example of the provided interface that is shared across the supported review providers.\n```php\n$trustpilot-\u003emerchant()-\u003einvite((array) $serviceInviteOptions);\n$trustpilot-\u003emerchant()-\u003efindReview((string) $reviewId);\n$trustpilot-\u003emerchant()-\u003egetReviews((array) $serviceReviewsFilterOptions);\n```\n\nThe ``PodPoint\\Reviews\\Providers\\Trustpilot\\Request\\AccessTokenRequest`` requires Cache Adapter/Driver. If you are getting CacheAdapterException you must set a cache driver.\n\nExample:\n```\nCacheProvider::setInstance(new LaravelCacheAdapter());\n```  \n\n## Compatibility table\nThis package is compatible up to Laravel 7. If used with higher versions of Laravel, the guzzle package needs to be upgraded.  \n\n| Laravel Version | Package Version |\n| ------------- | ------------- |\n| ^5.2  | 0.1.* |\n| ^6.0  | 0.1.* |\n| ^7.0  | 0.1.* |\n\nFor more details about each provider request options see:\n * [Trustpilot](https://github.com/Pod-Point/reviews-php/blob/master/src/Providers/Trustpilot/README.md) \n * [ReviewsIO](https://github.com/Pod-Point/reviews-php/blob/master/src/Providers/ReviewsIo/README.md) \n\n## Semantic versioning\nReviews PHP follows [semantic versioning](https://semver.org/) specifications.\n\n## License\nThe MIT License (MIT). Please see [License File](https://github.com/Pod-Point/reviews-php/LICENCE) for more information.\n\n## Development\n\n### Caching\n\nTo cache Request's response, you must extend the Request class using the **AbstractCacheableRequest** class, this will automatically cache the response. The **AbstractCacheableRequest** has two optional parameters ``$cacheTtl`` and ``$cacheKey``, these can be overridden in demanded request. If no ``$cacheKey`` is set the ``getCacheableKey`` is used to set the cache key and it will hash the class name using sha1 to have unique cacheKey. \n\nIf the Request class requires customisation for send method, make sure to call the ``parent::send();`` method which does the cache calls. \n\nIf the cache TTL is in the response of the api request instead of using **AbstractCacheableRequest** use the **AbstractHasCacheTtlInResponse** class. The **AbstractHasCacheTtlInResponse** has ``$cacheTtlResponseField`` which defines the key holds the cache TTL in the response and will be used when setting cache. \n\n#### CacheProvider\n\nThe CacheProvider is a singleton a special class, provides the adapters to be initialized within the ``AbstractCacheableRequest::__construct``.  \n\n#### Adding new Cache Adapters\nThe ``PodPoint\\Reviews\\Cache\\CacheProvider`` acts a Cache Adapter/Driver provider, the cache adapter can be replaced using ``CacheProvider::setInstance`` or the ``CacheProvider::getInstance`` can be updated to return Cache Adapter/Driver.\n\n#### Laravel Caching\n\nBy default, the ``PodPoint\\Reviews\\LaravelServiceProvider`` registers the LaravelCacheAdapter as an instance, if needs to be overridden a new extended ServiceProvider can be created to override the protected setCacheAdapter method. \n\n### Testing\n\nThis project uses PHPUnit, run the following command to run the tests:\n```bash\nvendor/bin/phpunit\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpod-point%2Freviews-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpod-point%2Freviews-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpod-point%2Freviews-php/lists"}