PHPackages                             wqa/php-gitbook - 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. wqa/php-gitbook

ActiveLibrary[API Development](/categories/api)

wqa/php-gitbook
===============

A PHP wrapper for the Gitbook API.

v1.0.0(5y ago)09MITPHP

Since Mar 17Pushed 5y ago1 watchersCompare

[ Source](https://github.com/WQA-Ltd/php-gitbook)[ Packagist](https://packagist.org/packages/wqa/php-gitbook)[ RSS](/packages/wqa-php-gitbook/feed)WikiDiscussions master Synced 6d ago

READMEChangelogDependencies (3)Versions (2)Used By (0)

Gitbook API wrapper for PHP
===========================

[](#gitbook-api-wrapper-for-php)

Note that The GitBook API is still in beta, so the underlying API and this wrapper are subject to change.

Install
=======

[](#install)

`composer require wqa/php-gitbook`

Usage
=====

[](#usage)

Create a client
---------------

[](#create-a-client)

```
$gitbook = new GitbookClient($secretKey);
```

Get the current user
--------------------

[](#get-the-current-user)

```
$gitbook->getCurrentUser();
```

Get user
--------

[](#get-user)

```
$gitbook->getUser($userUid);
```

Get spaces for current user
---------------------------

[](#get-spaces-for-current-user)

```
$gitbook->getSpaces();
```

Get spaces for specific user or organisation
--------------------------------------------

[](#get-spaces-for-specific-user-or-organisation)

```
$gitbook->getSpacesFor($userUid);
$gitbook->getSpacesFor($organisationUid);
```

Get space
---------

[](#get-space)

```
$gitbook->space($spaceUid)->get();
```

Get space revision
------------------

[](#get-space-revision)

```
$gitbook->space($spaceUid)->primaryRevision()->get();
$gitbook->space($spaceUid)->revision($revisionUid)->get();
```

Get space draft revision
------------------------

[](#get-space-draft-revision)

```
$gitbook->space($spaceUid)->draft($draftUid)->get();
```

Get space variant
-----------------

[](#get-space-variant)

```
$gitbook->space($spaceUid)->primaryRevision()->getVariant();
$gitbook->space($spaceUid)->primaryRevision()->getVariant('spanish');
```

Get page content
----------------

[](#get-page-content)

```
$gitbook->space($spaceUid)->primaryRevision()->getPage($pageUid);
$gitbook->space($spaceUid)->primaryRevision()->getPageByUrl($pageUrl);

// Get page content for variant
$gitbook->space($spaceUid)->primaryRevision()->getPage($pageUid, 'spanish');
$gitbook->space($spaceUid)->primaryRevision()->getPageByUrl($pageUrl, 'spanish');

// Get page content as markdown
$gitbook->space($spaceUid)->primaryRevision()->getPage($pageUid, 'master', PageFormat::Markdown);
$gitbook->space($spaceUid)->primaryRevision()->getPageByUrl($pageUrl, 'master', PageFormat::Markdown);
```

Get space assets
----------------

[](#get-space-assets)

```
$gitbook->space($spaceUid)->primaryRevision()->getAssets();
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

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

Unknown

Total

1

Last Release

1887d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/487559f7d72ea2a4a963dc9dc0764ac35a8583b05d0afec5322539510a4fe82e?d=identicon)[BenSampo](/maintainers/BenSampo)

---

Top Contributors

[![BenSampo](https://avatars.githubusercontent.com/u/1488068?v=4)](https://github.com/BenSampo "BenSampo (15 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/wqa-php-gitbook/health.svg)

```
[![Health](https://phpackages.com/badges/wqa-php-gitbook/health.svg)](https://phpackages.com/packages/wqa-php-gitbook)
```

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[convertkit/convertkitapi

Kit PHP SDK for the Kit API

2167.1k1](/packages/convertkit-convertkitapi)[mapado/rest-client-sdk

Rest Client SDK for hydra API

1125.9k2](/packages/mapado-rest-client-sdk)

PHPackages © 2026

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