PHPackages                             poposki/goodreads - 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. poposki/goodreads

AbandonedArchivedLibrary[API Development](/categories/api)

poposki/goodreads
=================

PHP wrapper for Goodreads API

v1.0.1(8y ago)51841[1 PRs](https://github.com/dpoposki/goodreads/pulls)MITPHPPHP &gt;=5.6

Since Dec 9Pushed 6y ago2 watchersCompare

[ Source](https://github.com/dpoposki/goodreads)[ Packagist](https://packagist.org/packages/poposki/goodreads)[ Docs](https://github.com/dpoposki/goodreads)[ RSS](/packages/poposki-goodreads/feed)WikiDiscussions master Synced yesterday

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

Goodreads PHP
=============

[](#goodreads-php)

[![Latest Version](https://camo.githubusercontent.com/2ca434d39b174459f927d05f1a06a115a52a28d9ab30bdcedc5fd08ff5f39a12/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f64706f706f736b692f676f6f6472656164732e7376673f7374796c653d666c61742d737175617265)](https://github.com/dpoposki/goodreads/releases)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)

A PHP client for consuming the Goodreads API.

Install
-------

[](#install)

Via Composer

```
$ composer require poposki/goodreads
```

Usage
-----

[](#usage)

This guide will help you navigate [configuring the client](#set-configuration-when-creating-the-provider), [authenticating your users and retrieving an access token](#authenticate-your-users-and-store-access-token), and [accessing the api on their behalf](#access-the-api-with-access-token).

Full provider documentation is available in the [API Guide](API-GUIDE.md).

*Make sure you have secured your Goodreads API keys before going further. You can check the Goodreads [API documentation](https://www.goodreads.com/api/documentation) and the [developer key](https://www.goodreads.com/api/keys) section.*

This project includes a [basic api example](https://github.com/dpoposki/goodreads/tree/master/example/index.php) and an OAuth authorization example.

### Configure the client

[](#configure-the-client)

The Goodreads provider needs a few configuration settings to operate successfully.

SettingDescription`identifier`Required, the application key associated with your application.`secret`Required, the application secret associated with your application.`callback_uri`Required when using package to help get access tokens.`oauth_token`Required when using the package to make authenticated API requests on behalf of a user.`oauth_token_secret`Required when using the package to make authenticated API requests on behalf of a user.#### Set configuration when creating the provider

[](#set-configuration-when-creating-the-provider)

```
$provider = new \Poposki\Goodreads\Provider([
    'identifier'         => 'your-application-key',
    'secret'             => 'your-application-secret',
    'callback_uri'       => 'http://your-callback-uri/',
    'oauth_token'        => 'abcdefghijklmnopqrstuvwxyz',
    'oauth_token_secret' => 'abcdefghijklmnopqrstuvwxyz',
]);
```

### Authenticate your users and store access token

[](#authenticate-your-users-and-store-access-token)

The Goodreads provider is capable of assisting you in walking your users through the OAuth authorization process and providing your application with access token credentials.

This package utilizes [The League's OAuth1 Client](https://github.com/thephpleague/oauth1-client) to provide this assistance.

```
// Create a provider instance.
$provider = new \Poposki\Goodreads\Provider([
    'identifier'   => 'your-application-key',
    'secret'       => 'your-application-secret',
    'callback_uri' => 'http://your-callback-uri/',
]);

// Obtain Temporary Credentials and User Authorization
// Goodreads does not use an oauth_verifier, instead they have an authorize param
// If the authorize param is 1, user has granted access, otherwise user denied access
if (!isset($_GET['oauth_token'], $_GET['authorize']) || $_GET['authorize'] != 1) {

    // First part of OAuth 1.0 authentication is to
    // obtain Temporary Credentials.
    $temporaryCredentials = $provider->getTemporaryCredentials();

    // Store credentials in the session, we'll need them later
    $_SESSION['temporary_credentials'] = serialize($temporaryCredentials);
    session_write_close();

    // Second part of OAuth 1.0 authentication is to obtain User Authorization
    // by redirecting the resource owner to the login screen on the server.
    // Create an authorization url.
    $authorizationUrl = $provider->getAuthorizationUrl($temporaryCredentials);

    // Redirect the user to the authorization URL. The user will be redirected
    // to the familiar login screen on the server, where they will login to
    // their account and authorize your app to access their data.
    header('Location: ' . $authorizationUrl);
    exit;

// Obtain Token Credentials
} else {

    try {

        // Retrieve the temporary credentials we saved before.
        $temporaryCredentials = unserialize($_SESSION['temporary_credentials']);

        // We will now obtain Token Credentials from the server.
        $tokenCredentials = $provider->getTokenCredentials(
            $temporaryCredentials,
            $_GET['oauth_token']
        );

        // We have token credentials, which we may use in authenticated
        // requests against the service provider's API.
        echo $tokenCredentials->getIdentifier() . "\n";
        echo $tokenCredentials->getSecret() . "\n";

        // Store token credentials so that you can use them for authorized requests later on
        // ...

    } catch (\Exception $e) {

        // Failed to get the token credentials or user details.
        exit($e->getMessage());

    }

}
```

### Access the API with access token

[](#access-the-api-with-access-token)

```
$provider = new \Poposki\Goodreads\Provider([
    'identifier'         => 'your-application-key',
    'secret'             => 'your-application-secret',
    'oauth_token'        => 'user-oauth-token',
    'oauth_token_secret' => 'user-oauth-token-secret',
]);

try {

    // Get id of user who authorized OAuth
    $user = $provider->getUserId();

    // Get info about an author by id
    $author = $provider->getAuthorById(7160538);

} catch (\Exception $e) {

    // Failed to get the token credentials.
    exit($e->getMessage());

}
```

Most of the methods available in the [API Guide](API-GUIDE.md) require entity ids to conduct business.

License
-------

[](#license)

Licensed under the MIT License - see the [LICENSE](LICENSE.md) file for details

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

3077d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3d9ebbab42cf3e61bcae0ae376a41411ce8111dcca536403aaf4808071ec7f68?d=identicon)[dpoposki](/maintainers/dpoposki)

---

Top Contributors

[![dpoposki](https://avatars.githubusercontent.com/u/10155725?v=4)](https://github.com/dpoposki "dpoposki (3 commits)")

---

Tags

phpapiclientwrapperGoodreads

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/poposki-goodreads/health.svg)

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

###  Alternatives

[kunalvarma05/dropbox-php-sdk

Dropbox PHP API V2 SDK (Unofficial)

3633.0M18](/packages/kunalvarma05-dropbox-php-sdk)[mozex/anthropic-php

Anthropic PHP is a supercharged community-maintained PHP API client that allows you to interact with Anthropic API.

46365.1k13](/packages/mozex-anthropic-php)

PHPackages © 2026

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