PHPackages                             toopher/toopher-api - 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. [API Development](/categories/api)
4. /
5. toopher/toopher-api

ActiveLibrary[API Development](/categories/api)

toopher/toopher-api
===================

Toopher PHP Client Library

40[2 issues](https://github.com/toopher/toopher-php/issues)[2 PRs](https://github.com/toopher/toopher-php/pulls)PHP

Since Dec 7Pushed 10y ago10 watchersCompare

[ Source](https://github.com/toopher/toopher-php)[ Packagist](https://packagist.org/packages/toopher/toopher-api)[ RSS](/packages/toopher-toopher-api/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (11)Used By (0)

ToopherAPI PHP Client
=====================

[](#toopherapi-php-client)

#### Introduction

[](#introduction)

ToopherAPI PHP Client simplifies the task of interfacing with the Toopher API from PHP code. This project includes all the dependency libraries and handles the required OAuth and JSON functionality so you can focus on just using the API.

#### Learn the Toopher API

[](#learn-the-toopher-api)

Make sure you visit  to get acquainted with the Toopher API fundamentals. The documentation there will tell you the details about the operations this API wrapper library provides.

#### OAuth Authentication

[](#oauth-authentication)

The first step to accessing the Toopher API is to sign up for an account at the development portal  and create a "requester". When that process is complete, your requester is issued OAuth 1.0a credentials in the form of a consumer key and secret. Your key is used to identify your requester when Toopher interacts with your customers, and the secret is used to sign each request so that we know it is generated by you. This library properly formats each request with your credentials automatically.

#### The Toopher Two-Step

[](#the-toopher-two-step)

Interacting with the Toopher web service involves two steps: pairing, and authenticating.

##### Pair

[](#pair)

Before you can enhance your website's actions with Toopher, your customers will need to pair their phone's Toopher app with your website. To do this, they generate a unique, nonsensical "pairing phrase" from within the app on their phone. You will need to prompt them for a pairing phrase as part of the Toopher enrollment process. Once you have a pairing phrase, just send it to the Toopher API along with your requester credentials and we'll return a pairing ID that you can use whenever you want to authenticate an action for that user.

##### Authenticate

[](#authenticate)

You have complete control over what actions you want to authenticate using Toopher (for example: logging in, changing account information, making a purchase, etc.). Just send us the user's pairing ID, a name for the terminal they're using, and a description of the action they're trying to perform and we'll make sure they actually want it to happen.

#### Librarified

[](#librarified)

This library makes it super simple to do the Toopher two-step. Check it out:

```
require_once("toopher_api.php");

// Create an API object using your credentials
$toopherApi = new ToopherAPI($key, $secret);

// Step 1 - Pair with their phone's Toopher app
$pairingStatus = $toopherApi->pair("pairing phrase", "username@yourservice.com");

// Step 2 - Authenticate a log in
$authStatus = $toopherApi->authenticate($pairingStatus['id'], "my computer");

// Once they've responded you can then check the status
while($authStatus['pending']){
    $authStatus = $toopherApi->getAuthenticationStatus($authStatus['id']);
    sleep(1);
}
if($authStatus['granted']){
    // Success!
} else {
    // user declined the authorization!
}
```

#### Dependencies

[](#dependencies)

Toopher manages dependencies with [composer](http://getcomposer.org). To ensure all dependencies are up-to-date, execute the following command:

```
$ composer install
```

from the root directory the package (the same directory that this README is located in)

#### Handling Errors

[](#handling-errors)

If any request runs into an error a `ToopherRequestException` will be thrown with more details on what went wrong.

#### Example code

[](#example-code)

Check out demo/toopher\_demo.php for an example program that walks you through the whole process! Simply execute the script as follows:

```
$ php demo/toopher_demo.php
```

To avoid being prompted for your Toopher API key and secret, you can define them in the $TOOPHER\_CONSUMER\_KEY and $TOOPHER\_CONSUMER\_SECRET environment variables

#### Tests

[](#tests)

To run all unit tests:

```
$ phpunit test/test_toopher_api.php
```

Note: `phpunit` may be found in `vendor/bin/php` so your test command would be

```
$ vendor/bin/phpunit test/test_toopher_api.php
```

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 73.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/a5f1a41eab89647aa7399a2caacadc50a15bedcc0cf7c93d40aeb5de1fa2bd24?d=identicon)[dshafer](/maintainers/dshafer)

---

Top Contributors

[![dshafer](https://avatars.githubusercontent.com/u/1216562?v=4)](https://github.com/dshafer "dshafer (22 commits)")[![smholloway](https://avatars.githubusercontent.com/u/259121?v=4)](https://github.com/smholloway "smholloway (7 commits)")[![JamesCullum](https://avatars.githubusercontent.com/u/5477111?v=4)](https://github.com/JamesCullum "JamesCullum (1 commits)")

### Embed Badge

![Health badge](/badges/toopher-toopher-api/health.svg)

```
[![Health](https://phpackages.com/badges/toopher-toopher-api/health.svg)](https://phpackages.com/packages/toopher-toopher-api)
```

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35916.4M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24016.2M19](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172445.0k12](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

93459.5k6](/packages/botman-driver-telegram)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
