PHPackages                             carboneio/carbone-sdk-php - 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. [PDF &amp; Document Generation](/categories/documents)
4. /
5. carboneio/carbone-sdk-php

ActiveLibrary[PDF &amp; Document Generation](/categories/documents)

carboneio/carbone-sdk-php
=========================

Official Carboneio PHP SDK to generate documents through the Carbone CLOUD API.

v2.1.0(3mo ago)11203.6k↓50.9%5[1 issues](https://github.com/carboneio/carbone-sdk-php/issues)[2 PRs](https://github.com/carboneio/carbone-sdk-php/pulls)1MITPHPPHP ^8.2CI passing

Since Jan 13Pushed 3mo ago2 watchersCompare

[ Source](https://github.com/carboneio/carbone-sdk-php)[ Packagist](https://packagist.org/packages/carboneio/carbone-sdk-php)[ Docs](https://github.com/carboneio/carbone-sdk-php)[ RSS](/packages/carboneio-carbone-sdk-php/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (5)Dependencies (6)Versions (10)Used By (1)

Carbone PHP SDK
===============

[](#carbone-php-sdk)

This package provides a PHP SDK for the [Carbone.io](https://carbone.io) Cloud API.

[![Cover](./carbone-sdk-php.png)](./carbone-sdk-php.png)

About Carbone
-------------

[](#about-carbone)

Carbone is a powerful and easy to use API to generate documents from a template to a PDF. It is based on LibreOffice and can convert any document supported by LibreOffice. It is also possible to convert HTML to PDF. Learn more about [supported files and features](https://carbone.io/documentation.html#supported-files-and-features-list).

Installation
------------

[](#installation)

You can install the bindings via [Composer](http://getcomposer.org/). Run the following command:

```
composer require carboneio/carbone-sdk-php
```

Usage
-----

[](#usage)

### Carbone instance

[](#carbone-instance)

Using the SDK is very easy. You just need to create a new instance of the Carbone class and provide your API key. Get your API key on your Carbone account: .

```
use Carboneio\SDK\Carbone;

$carbone = new Carbone('YOUR_API_KEY', 'https://api.carbone.io/');
```

### Upload a template

[](#upload-a-template)

You can upload a template to Carbone using the `upload` method. This method takes the content of the template as base64. The method returns a `template ID` used to [generate documents](#render-a-template).

```
$response = $carbone->templates()->upload($contentBase64);

$templateId = $response->getTemplateId();
```

Example to [upload a template](./examples/upload_template.php)

### Render a template

[](#render-a-template)

You can generate a document using the `render` method. This method takes the `template Id` and the data as parameters. A `render ID` is returned and must be used to [download the generated document](#download-a-rendered-template).

```
$response = $carbone->renders()->render($templateId, $data);

$renderId = $response->getRenderId();
```

Example to [render a template](./examples/render_report.php)

### Download a rendered template

[](#download-a-rendered-template)

You can download a rendered template using the `download` method. This method takes the `render ID` as a parameter.

```
$response = $carbone->renders()->download($renderId);

// Save the contents of the file yourself on your filesystem
$content = $response->getContent();
```

Example to [download a rendered document](./examples/download_report.php)

### Delete a template

[](#delete-a-template)

You can delete a template using the `delete` method. This method takes the `template Id` as a parameter.

```
$response = $carbone->templates()->delete($templateId);
```

Example to [delete a template](./examples/delete_template.php)

### Download a template

[](#download-a-template)

You can download a template using the `download` method. This method takes the `template Id` as a parameter.

```
$response = $carbone->templates()->download($templateId);
```

Example to [download a template](./examples/download_template.php)

### Add custom headers

[](#add-custom-headers)

Set custom headers, such as "carbone-version" to select a specific [Carbone version](https://carbone.io/api-reference.html#api-version). By default, the SDK request the version 4 of Carbone.

```
$carbone->headers()->set([
  "carbone-version" => 4,
  /** Uncomment to delete automatically templates after a specific time */
  // "carbone-template-delete-after" => 86400, // 86400s = 1 day | https://carbone.io/api-reference.html#template-storage
  // "carbone-webhook-url" => "https://my-server", // https://carbone.io/api-reference.html#api-webhook
]);
```

### Get API Status

[](#get-api-status)

```
$response = $carbone->getStatus();
$json = $response->json();

echo "Status : " . $response->status() . "\n";
echo "Success: " . $json['success'] . "\n";
echo "Version: " . $json['version'] . "\n";
echo "Message: " . $json['message'] . "\n";
```

🧪 Run tests
-----------

[](#-run-tests)

First install required composer packages:

```
composer install
```

Then execute tests:

```
composer test
```

👤 History
---------

[](#-history)

The package was originaly made by [MadeByBob](https://github.com/madebybob) and open-sourced the code. The Carbone.io team is now maintaining the SDK and will bring all futur evolutions.
Original repository:
MadeByBob website:

🤝 Contributing
--------------

[](#-contributing)

Contributions, issues and feature requests are welcome!

Feel free to check [issues page](https://github.com/carboneio/carbone-sdk-php/issues).

Show your support
-----------------

[](#show-your-support)

Give a ⭐️ if this project helped you!

###  Health Score

55

—

FairBetter than 97% of packages

Maintenance80

Actively maintained with recent releases

Popularity42

Moderate usage in the ecosystem

Community18

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 51.9% 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 ~234 days

Recently: every ~284 days

Total

6

Last Release

97d ago

Major Versions

1.1.0 → v2.0.02024-11-05

PHP version history (2 changes)1.0.0PHP ^8.1

v2.0.0PHP ^8.2

### Community

Maintainers

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

---

Top Contributors

[![steevepay](https://avatars.githubusercontent.com/u/16964532?v=4)](https://github.com/steevepay "steevepay (28 commits)")[![dgrelaud](https://avatars.githubusercontent.com/u/1288509?v=4)](https://github.com/dgrelaud "dgrelaud (21 commits)")[![Sammyjo20](https://avatars.githubusercontent.com/u/29132017?v=4)](https://github.com/Sammyjo20 "Sammyjo20 (3 commits)")[![arem-t-gh](https://avatars.githubusercontent.com/u/66364379?v=4)](https://github.com/arem-t-gh "arem-t-gh (1 commits)")[![neverything](https://avatars.githubusercontent.com/u/368120?v=4)](https://github.com/neverything "neverything (1 commits)")

---

Tags

automationdocumentdocxdocx-generatorpdfphpreportingsdkxlsx

###  Code Quality

TestsPest

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/carboneio-carbone-sdk-php/health.svg)

```
[![Health](https://phpackages.com/badges/carboneio-carbone-sdk-php/health.svg)](https://phpackages.com/packages/carboneio-carbone-sdk-php)
```

###  Alternatives

[jlevers/selling-partner-api

PHP client for Amazon's Selling Partner API

4335.4M2](/packages/jlevers-selling-partner-api)[saloonphp/laravel-plugin

The official Laravel plugin for Saloon

807.1M201](/packages/saloonphp-laravel-plugin)[ohdearapp/ohdear-php-sdk

An SDK to easily work with the Oh Dear API

743.0M17](/packages/ohdearapp-ohdear-php-sdk)[mehrancodes/laravel-harbor

A CLI tool to Quickly create On-Demand preview environment for your apps.

10097.5k](/packages/mehrancodes-laravel-harbor)[whatsdiff/whatsdiff

See what's changed in your project's dependencies

771.2k](/packages/whatsdiff-whatsdiff)[myoutdeskllc/salesforce-php

salesforce library for php8+

1579.5k](/packages/myoutdeskllc-salesforce-php)

PHPackages © 2026

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