File: D:/HostingSpaces/SBogers10/ste.komma.pro/vendor/komma/feedback-company/README.md
# feedback-company-client-php
An API wrapper for the Feedback Company webservice
<p><img src="https://poser.pugx.org/laravel/framework/license.svg" alt="License"></p>
Installation
------------
For now, we can register it by appending
```
"komma/feedback-company": "dev-master"
```
to our Composer and assigning the private repository.
```
"repositories": [
{
"type": "git",
"url": "git@github.com:KommaGit/feedback-company-client-php.git"
}
]
```
Of course run ``composer install`` to get these dependencies added to your vendor directory. Or ``composer update`` if you already have a composer.lock file present.
How to use
----------
Before make the ``new FeedbackCompanyApi()`` make sure the ClientId and the ClientSecret has been defined. We have provided a native PHP way and by using the Laravel services config.
### Setup credentials ###
Make sure your Feedback Company account has been enabled for API usage.
When enabled you should also be able to get a 'Client ID' and 'Client Secret' for your account.
When changing the credentials make sure you also clear the cache Access Token. By default, this can be found in the 'storage/feedbackCompany' folder.
#### Plain PHP ####
Call the static attributes;
```
FeedbackCompanyApi::$clientId = 'your-client-id';
FeedbackCompanyApi::$clientSecret = 'your-client-secret';
FeedbackCompanyApi::$debug = true; // Optional
```
#### Laravel ####
If you work with Laravel (6+) you also append the credentials to the services config. On the construct of the FeedbackCompanyApi it will automatically try to load these by calling the config function and then assign the right static attributes.
To use this you should add the following settings to the services config;
```
'feedback_company' => [
'id' => env('FEEDBACK_COMPANY_ID', ''),
'secret' => env('FEEDBACK_COMPANY_SECRET', ''),
'debug' => env('FEEDBACK_COMPANY_DEBUG', false),
],
```
it's good practise to store the credentials inside the .env instead of directly in the config, but that is up to you!
If you also have the [Barryvdh/laravel-debugbar](https://github.com/barryvdh/laravel-debugbar) installed, and the debug is enabled it will use that instead of just echoing the data.
### Available functions
We have mapped the functions as stated in the OAuth2.0 API.
Meaning the following functions have provided;
#### Questions Endpoint
###### All - Retrieve the list of questions for this account.
```
$feedbackCompanyApi = new FeedbackCompanyApi();
$feedbackCompanyApi->questions->all();
```
#### Reviews Endpoint
###### All - Retrieve all the reviews for this account.
###### Recent - Retrieve all the recent reviews for this account.
###### Get - Get a specific review for this account.
###### Summary - Get the summary for this account.
```
$feedbackCompanyApi = new FeedbackCompanyApi();
$feedbackCompanyApi->reviews->all();
$feedbackCompanyApi->reviews->recent();
$feedbackCompanyApi->reviews->get(12345);
$feedbackCompanyApi->reviews->summary();
```