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.0.1(4mo ago)11193.3k—9.4%5[2 PRs](https://github.com/carboneio/carbone-sdk-php/pulls)1MITPHPPHP ^8.2CI passing

Since Jan 13Pushed 4mo 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 1mo ago

READMEChangelog (4)Dependencies (3)Versions (9)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

53

—

FairBetter than 97% of packages

Maintenance74

Regular maintenance activity

Popularity42

Moderate usage in the ecosystem

Community18

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 52% 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 ~269 days

Total

5

Last Release

146d 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 (26 commits)")[![dgrelaud](https://avatars.githubusercontent.com/u/1288509?v=4)](https://github.com/dgrelaud "dgrelaud (21 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)")[![Sammyjo20](https://avatars.githubusercontent.com/u/29132017?v=4)](https://github.com/Sammyjo20 "Sammyjo20 (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

[spatie/browsershot

Convert a webpage to an image or pdf using headless Chrome

5.2k32.1M102](/packages/spatie-browsershot)[barryvdh/laravel-snappy

Snappy PDF/Image for Laravel

2.8k24.8M48](/packages/barryvdh-laravel-snappy)[openspout/openspout

PHP Library to read and write spreadsheet files (CSV, XLSX and ODS), in a fast and scalable way

1.2k57.6M131](/packages/openspout-openspout)[setasign/tfpdf

This class is a modified version of FPDF that adds UTF-8 support. The latest version is based on FPDF 1.85.

426.1M30](/packages/setasign-tfpdf)[aspera/xlsx-reader

Spreadsheet reader library for XLSX files

52742.2k5](/packages/aspera-xlsx-reader)[asika/pdf2text

Simple PHP PDF to text class.

25828.1k](/packages/asika-pdf2text)

PHPackages © 2026

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