PHPackages                             fbng/netgalley-api-client - 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. fbng/netgalley-api-client

ActiveLibrary[API Development](/categories/api)

fbng/netgalley-api-client
=========================

NetGalley Public API Client

2.4.0(5y ago)297MITPHPPHP &gt;=5.4

Since Nov 21Pushed 5y ago14 watchersCompare

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

READMEChangelogDependenciesVersions (10)Used By (0)

NetGalley Public REST API Client
================================

[](#netgalley-public-rest-api-client)

The NetGalley Public REST API provides a way for NetGalley's partners to interact with the system. The library currently supports only PHP, but the API itself can of course be accessed via REST by any system.

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

[](#installation)

To install with [Composer](https://getcomposer.org/), add the following to your `composer.json` file:

```
    "require": {
        ...
        "fbng/netgalley-api-client": "*",
        ...
    },

```

Then run a `composer update` and you should be all set.

To install without Composer, download the latest archive, extract it to your project, and add the appropriate `require_once` line to your code:

```
require_once('/path/to/lib/NetGalley/API/Client.php');
```

If you are connecting to the NetGalley API using OAuth2 (more about this below), also add the `require_once` line:

```
require_once('/path/to/lib/NetGalley/API/OauthClient.php');
```

Usage
=====

[](#usage)

To use the client library, first obtain a set of API credentials from NetGalley (contact your concierge representative if you have any questions). These credentials will either be a Key / Secret pair or an OAuth Client ID / Secret pair, which will determine which method below you will use to access the NetGalley API.

Key / Secret connection method
------------------------------

[](#key--secret-connection-method)

If you have received Key / Secret credentials, use this example code as a basis for accessing the API:

```
use NetGalley\API\Client;

// obtain your credentials from NetGalley
$myUser = 'example';
$myApiKey = 'KEY';
$myApiSecret = 'SECRET';

// if set to true, the client will target a staging server
$testMode = true;

// instantiate the client using your credentials
$client = new Client($myUser, $myApiKey, $myApiSecret, $testMode);

// make an API request; see the relevant documentation
// for details of the API you are requesting; here we
// are creating a new widget for a customer
$response = $client->makeRequest('/private/widgets', 'POST', array(
    'email' => 'customer@gmail.com',
    'isbn' => '1234567890123',
    'market' => 'US',
    'temporaryDrm' => false,
    'firstName' => 'Some',
    'lastName' => 'Customer'
));

// the response will be a JSON-encoded string, so decode it
$response = json_decode($response, true);

// do something with the response
echo 'Response was: ' . print_r($response, true) . PHP_EOL;
```

OAuth2 Client ID / Secret connection method
-------------------------------------------

[](#oauth2-client-id--secret-connection-method)

If you have received OAuth2 credentials, use this example code as a basis for accessing the API:

```
use NetGalley\API\OauthClient;

// obtain your credentials from NetGalley
$clientId = 'CLIENTID';
$clientSecret = 'SECRET';

// if requesting a token to grant third-party access, set the authorization
// code captured by the redirect URI
//
// NOTE: the NetGalley API does not currently support authorizing third-party
// access - this is included only to avoid conflicts in client implementations
// in the future if it ever becomes a supported feature
$authorizationCode = '';

// if set to true, the client will target a staging server
$testMode = true;

// instantiate the client using your credentials
$client = new OauthClient($clientId, $clientSecret, $authorizationCode, $testMode);

// request an access token once (will be set internally for subsequent requests)
$client->requestToken();

// make requests and handle responses the same as above
$response = null;
```

Handling Large Data Results
---------------------------

[](#handling-large-data-results)

If you are granted access to any reporting APIs, you may foresee instances in your application where large data sets may be coming from the API. You can avoid loading the entire data set into memory by streaming the results directly into a temporary file.

In the example below, `$responseFile` is a file handle resource to a temporary file containing the response data from the API request. You can then write the file contents to the output buffer to provide a CSV download, for example, or rename the file to a permanent location.

```
$responseFile = $client->makeFileRequest('/private/reports/example_report', 'GET', array('filter' => 'example'));

if ($responseFile !== false) {

    // Do something with $responseFile

    fclose($responseFile);
}
```

API Documentation
=================

[](#api-documentation)

See the [API Documentation](http://htmlpreview.github.com/?https://github.com/fbng/netgalley-api-client/blob/master/documentation/index.html) within this repository for up-to-date information on each REST API.

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity64

Established project with proven stability

 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 ~253 days

Recently: every ~437 days

Total

9

Last Release

2165d ago

Major Versions

1.0.0 → 2.0.02015-08-18

### Community

Maintainers

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

---

Top Contributors

[![sarcher](https://avatars.githubusercontent.com/u/157295?v=4)](https://github.com/sarcher "sarcher (8 commits)")

---

Tags

apiclientnetgalleyfirebrandfbng

### Embed Badge

![Health badge](/badges/fbng-netgalley-api-client/health.svg)

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

###  Alternatives

[deepseek-php/deepseek-php-client

deepseek PHP client is a robust and community-driven PHP client library for seamless integration with the Deepseek API, offering efficient access to advanced AI and data processing capabilities.

47073.9k5](/packages/deepseek-php-deepseek-php-client)[skeeks/yii2-google-api

Component for work with google api based on google/apiclient

1243.1k1](/packages/skeeks-yii2-google-api)

PHPackages © 2026

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