usabilla/usabilla-api-php

0.5.0 2017-12-22 11:06 UTC

This package is not auto-updated.

Last update: 2024-05-11 17:12:28 UTC


README

Build Status Code Climate Test Coverage

This package allows PHP developers to gain access to the Usabilla resources such as buttons, feedback items, campaigns and their results. This packages is heavily inspired by the AWS PHP Client.

Resources

Features

  • Built for PHP 5.6+ and compliant with PSR-4.
  • Built on Guzzle Services.
  • Installable through Composer.

Getting Started

  1. Install Composer by following installation instructions on: https://getcomposer.org/download/
  2. Request Usabilla API credentials.
  3. Run composer require usabilla/usabilla-api-php on your project.

Quick Example

Request 5 feedback items belonging to a button.

<?php

require 'vendor/autoload.php';

use Usabilla\API\Client\UsabillaClient;

// Creates a new Usabilla client.
$client = new UsabillaClient('ACCESS_KEY', 'SECRET_KEY');

// Specify the parameters as mentioned in the service description.
$params = ['id' => 'BUTTON_ID', 'limit' => 5];

// Gets the command.
$command = $client->getCommand('GetWebsiteFeedbackItems', $params);

// Executes the command.
$response = $client->execute($command);

// Prints the received response.
print_r($response);

Using Command Line

You can use the command line to retrieve results from the API using scripts found in the example folder:

  • Using single_page.php : php single_page.php {command} {access-key} {secret-key}

  • Using single_page_with_id.php : php single_page_with_id.php {command} {id} {access-key} {secret-key}

More examples: