PHPackages                             thecodingmachine/gotenberg-php-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. thecodingmachine/gotenberg-php-client

AbandonedArchivedLibrary[API Development](/categories/api)

thecodingmachine/gotenberg-php-client
=====================================

A client for sending files to a Gotenberg API

6.3.0(5y ago)1031.7M—0.8%20[5 PRs](https://github.com/thecodingmachine/gotenberg-php-client/pulls)MITPHPPHP &gt;=7.1

Since Apr 18Pushed 2y ago12 watchersCompare

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

READMEChangelog (10)Dependencies (13)Versions (22)Used By (0)

⚠️ For **Gotenberg 7.x**, use [gotenberg-/gotenberg-php](https://github.com/gotenberg/gotenberg-php) instead.

*This library is unmaintained and will not receive updates. Consider migrating to *Gotenberg 7.x* and the according new library instead.*

Gotenberg PHP client
====================

[](#gotenberg-php-client)

A simple PHP client for interacting with a Gotenberg API.

Install
-------

[](#install)

Unless your project already have a PSR7 `HttpClient`, install `php-http/guzzle6-adapter`:

```
$ composer require php-http/guzzle6-adapter
```

Then the PHP client:

```
$ composer require thecodingmachine/gotenberg-php-client
```

Usage
-----

[](#usage)

```
use TheCodingMachine\Gotenberg\Client;
use TheCodingMachine\Gotenberg\ClientException;
use TheCodingMachine\Gotenberg\DocumentFactory;
use TheCodingMachine\Gotenberg\HTMLRequest;
use TheCodingMachine\Gotenberg\Request;
use TheCodingMachine\Gotenberg\RequestException;
use GuzzleHttp\Psr7\LazyOpenStream;

# create the client.
$client = new Client('http://localhost:3000', new \Http\Adapter\Guzzle6\Client());
# ... or the following if you want the client to discover automatically an installed implementation of the PSR7 `HttpClient`.
$client = new Client('http://localhost:3000');

# prepare the files required for your conversion.

# from a path.
$index = DocumentFactory::makeFromPath('index.html', '/path/to/file');
# ... or from your own stream.
$stream = new LazyOpenStream('/path/to/file', 'r');
$index = DocumentFactory::makeFromStream('index.html', $stream);
// ... or from a string.
$index = DocumentFactory::makeFromString('index.html', 'Foo');

$header = DocumentFactory::makeFromPath('header.html', '/path/to/file');
$footer = DocumentFactory::makeFromPath('footer.html', '/path/to/file');
$assets = [
    DocumentFactory::makeFromPath('style.css', '/path/to/file'),
    DocumentFactory::makeFromPath('img.png', '/path/to/file'),
];

try {
    $request = new HTMLRequest($index);
    $request->setHeader($header);
    $request->setFooter($footer);
    $request->setAssets($assets);
    $request->setPaperSize(Request::A4);
    $request->setMargins(Request::NO_MARGINS);
    $request->setScale(0.75);

    # store method allows you to... store the resulting PDF in a particular destination.
    $client->store($request, 'path/you/want/the/pdf/to/be/stored.pdf');

    # if you wish to redirect the response directly to the browser, you may also use:
    $client->post($request);
} catch (RequestException $e) {
    # this exception is thrown if given paper size or margins are not correct.
} catch (ClientException $e) {
    # this exception is thrown by the client if the API has returned a code != 200.
}
```

For more complete usages, head to the [documentation](https://gotenberg.dev/).

Badges
------

[](#badges)

[![Travis CI](https://camo.githubusercontent.com/b210f20f6ca01d84fbc8179170a32c45ed1d046e8639f5976609c5070773ae4b/68747470733a2f2f7472617669732d63692e6f72672f746865636f64696e676d616368696e652f676f74656e626572672d7068702d636c69656e742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/thecodingmachine/gotenberg-php-client)[![Scrutinizer](https://camo.githubusercontent.com/046856bd109709be06e06fa6cc79d4cf77b6db3d2818a85bc073582e61d49948/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f746865636f64696e676d616368696e652f676f74656e626572672d7068702d636c69656e742f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/thecodingmachine/gotenberg-php-client/?branch=master)

###  Health Score

45

—

FairBetter than 93% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity54

Moderate usage in the ecosystem

Community22

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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

Recently: every ~113 days

Total

18

Last Release

1960d ago

Major Versions

1.0.1 → 2.0.02018-04-19

2.0.1 → 3.0.02018-12-10

3.2.0 → 4.0.02019-01-28

4.3.0 → 5.0.02019-04-14

5.0.0 → 6.0.02019-08-23

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1847918?v=4)[TheCodingMachine](/maintainers/thecodingmachine)[@thecodingmachine](https://github.com/thecodingmachine)

---

Top Contributors

[![rodnaph](https://avatars.githubusercontent.com/u/447579?v=4)](https://github.com/rodnaph "rodnaph (4 commits)")[![gulien](https://avatars.githubusercontent.com/u/8983173?v=4)](https://github.com/gulien "gulien (4 commits)")[![bendavies](https://avatars.githubusercontent.com/u/625392?v=4)](https://github.com/bendavies "bendavies (1 commits)")[![mdjward](https://avatars.githubusercontent.com/u/4046455?v=4)](https://github.com/mdjward "mdjward (1 commits)")[![tigitz](https://avatars.githubusercontent.com/u/1524501?v=4)](https://github.com/tigitz "tigitz (1 commits)")[![lcp0578](https://avatars.githubusercontent.com/u/10859621?v=4)](https://github.com/lcp0578 "lcp0578 (1 commits)")[![florentdestremau](https://avatars.githubusercontent.com/u/2852204?v=4)](https://github.com/florentdestremau "florentdestremau (1 commits)")

---

Tags

apiexcelgotenberghtmlmarkdownpdfpdf-converterphppowerpointwordapiclientpdfhtmlmarkdownwordofficePowerPointGotenberg

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/thecodingmachine-gotenberg-php-client/health.svg)

```
[![Health](https://phpackages.com/badges/thecodingmachine-gotenberg-php-client/health.svg)](https://phpackages.com/packages/thecodingmachine-gotenberg-php-client)
```

###  Alternatives

[gotenberg/gotenberg-php

A PHP client for interacting with Gotenberg, a developer-friendly API for converting numerous document formats into PDF files, and more!

3685.2M19](/packages/gotenberg-gotenberg-php)[openai-php/client

OpenAI PHP is a supercharged PHP API client that allows you to interact with the Open AI API

5.8k22.6M232](/packages/openai-php-client)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[algolia/algoliasearch-client-php

API powering the features of Algolia.

69433.0M114](/packages/algolia-algoliasearch-client-php)[theodo-group/llphant

LLPhant is a library to help you build Generative AI applications.

1.5k311.5k5](/packages/theodo-group-llphant)[phpro/http-tools

HTTP tools for developing more consistent HTTP implementations.

28137.8k](/packages/phpro-http-tools)

PHPackages © 2026

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