PHPackages                             uservoice/uservoice - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. uservoice/uservoice

AbandonedArchivedLibrary[Authentication &amp; Authorization](/categories/authentication)

uservoice/uservoice
===================

UserVoice PHP Library for API Connections

0.0.10(9y ago)9215.3k↓26.5%9[5 issues](https://github.com/uservoice/uservoice-php/issues)1MITPHPPHP &gt;=5.3

Since Oct 30Pushed 6y ago23 watchersCompare

[ Source](https://github.com/uservoice/uservoice-php)[ Packagist](https://packagist.org/packages/uservoice/uservoice)[ Docs](https://github.com/uservoice/uservoice-php)[ RSS](/packages/uservoice-uservoice/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (11)Used By (1)

⛔ \[DEPRECATED\] This repository is no longer actively maintained. You may fork the project but we are no longer accepting pull requests or new issues. You may reach out to  with questions.

UserVoice PHP library for API connections
=========================================

[](#uservoice-php-library-for-api-connections)

This library allows you to easily:

- Generate SSO token for creating SSO users / logging them into UserVoice ().
- Do 3-legged and 2-legged UserVoice API calls safely without having to worry about the cryptographic details (unless you want).

Installation
============

[](#installation)

For installing OAuth, you should check if your operating system packaging system has PHP OAuth package available and that your php version has been compiled with openssl ([instructions](http://php.net/manual/en/openssl.installation.php)). For example, for PHP 5.4 Homebrew comes with packages php54-oauth. If your packaging systems is unable to install OAuth for PHP, you just need to install [PECL/PEAR](http://pear.php.net/manual/en/installation.getting.php).

After getting PEAR you should have the command 'pecl' available, so run ([detailed instructions](http://www.php.net/manual/en/oauth.setup.php). Homebrew equivalent: `brew install php54-oauth`):

```
sudo pecl install oauth
```

When you get oauth installed, specify them in your php.ini file:

```
extension=oauth.so
```

You also need openssl ([detailed instructions](http://php.net/manual/en/openssl.installation.php))

Finally, install [Composer](http://getcomposer.org/download/) and place composer.phar in your PATH. Add uservoice/uservoice in your composer.json:

```
"uservoice/uservoice": ">=0.0.5"
```

Then install project dependencies using Composer:

```
composer.phar install
```

Now you should be good to go!

Examples
========

[](#examples)

Prerequisites:

- php must have been compiled with openssl and oauth need to be installed. Check installation instructions above.
- Place the following configuration parameters somewhere in your application:

```
# Suppose your UserVoice site is at http://uservoice-subdomain.uservoice.com/
$USERVOICE_SUBDOMAIN = 'uservoice-subdomain';
$SSO_KEY = '982c88f2df72572859e8e23423eg87ed'; # Admin Console -> Settings -> General -> User Authentication

# Define an API client at: Admin Console -> Settings -> Channels -> API
$API_KEY = 'oQt2BaunWNuainc8BvZpAm';
$API_SECRET = '3yQMSoXBpAwuK3nYHR0wpY6opE341inL9a2HynGF2';

// Use autoload.php of Composer to use the library and its dependencies:
require_once('vendor/autoload.php');
```

SSO-token generation using uservoice library
--------------------------------------------

[](#sso-token-generation-using-uservoice-library)

SSO-token can be used to create sessions for SSO users. They are capable of synchronizing the user information from one system to another. Generating the SSO token from SSO key and given uservoice subdomain can be done by calling UserVoice\\SSO::generate\_sso\_token method like this:

```
