Use Marqius Kern with PHP, Laravel and Symfony
gotenberg-php, the Symfony bundle and laravel-pdf call Gotenberg's API at the address you give them. Marqius Kern answers that API, Gotenberg 8's and 9's on one server, from a 41 MB image: change the image your compose file or manifest runs, and your PHP code stays as it is.
Marqius

Try it · Review compatibility results
The container image to use in your Compose file or deployment manifest:
image: marqius/kerngotenberg-php 2 and 3, each in one folder.
gotenberg-php calls the address you pass to Gotenberg::chromium(), Gotenberg::libreOffice() and Gotenberg::pdfEngines() (Gotenberg::pdf() in version 3); that address stays as it is. Version 2 speaks Gotenberg 8's API, version 3 Gotenberg 9's; Marqius Kern answers both. Follow the part for the version you use.
Version 2, for Gotenberg 8
You need: Docker, curl, PHP 8.1 or later and Composer.
It takes: about 5 minutes.
Step 1. Start Marqius Kern
In a new, empty folder, start Marqius Kern and wait until it answers. The first command starts it in the background, as a container named kern on port 3000; the second asks its health check until it answers.
docker run --rm -d --name kern -p 3000:3000 marqius/kern
curl -sS --fail --retry 10 --retry-delay 1 --retry-all-errors http://localhost:3000/healthYou should see: a long string of letters and digits (the container's ID), then a line that begins {"status":"up".
Step 2. Install the client
This installs version 2.27.0, with Guzzle as its HTTP client, as the library's own guide advises. If Composer asks whether to trust php-http/discovery, either answer works here.
composer require gotenberg/gotenberg-php:2.27.0 php-http/guzzle7-adapter:1.1.0You should see: Composer list each package it installs, among them - Installing gotenberg/gotenberg-php (v2.27.0): Extracting archive.
Step 3. Make a small price list
printf 'Item,Qty,Price\nTea,2,3.50\nCoffee,1,4.20\n' > prices.csvYou should see: nothing printed; the folder now holds prices.csv.
Step 4. Write the program
Save this as convert.php:
<?php
require __DIR__ . '/vendor/autoload.php';
use Gotenberg\Gotenberg;
use Gotenberg\Stream;
$address = 'http://localhost:3000';
$invoice = Gotenberg::chromium($address)
->pdf()
->outputFilename('invoice')
->html(Stream::string('index.html', '<h1>Invoice 1001</h1><p>Thank you for your order.</p>'));
Gotenberg::save($invoice, __DIR__);
$prices = Gotenberg::libreOffice($address)
->outputFilename('prices')
->convert(Stream::path(__DIR__ . '/prices.csv'));
Gotenberg::save($prices, __DIR__);
echo "Saved invoice.pdf and prices.pdf\n";Step 5. Run it, then stop Marqius Kern
php convert.php
docker stop kernYou should see:
Saved invoice.pdf and prices.pdf
kernThere are now two new files in the folder: invoice.pdf, with the heading Invoice 1001, and prices.pdf, with the price list.
Version 3, for Gotenberg 9
You need: Docker, curl, PHP 8.3 or later and Composer.
It takes: about 5 minutes.
Step 1. Start Marqius Kern as Gotenberg 9
In a new, empty folder, start Marqius Kern with KERN_GOTENBERG_VERSION=9.10.3 (-e gives the container this setting): it then reports 9.10.3 and answers a request that names neither version as Gotenberg 9 does. The second command waits until it answers.
docker run --rm -d --name kern -p 3000:3000 -e KERN_GOTENBERG_VERSION=9.10.3 marqius/kern
curl -sS --fail --retry 10 --retry-delay 1 --retry-all-errors http://localhost:3000/healthYou should see: a long string of letters and digits (the container's ID), then a line that begins {"status":"up".
Step 2. Install the client
This installs version 3.9.0 the same way, with Guzzle.
composer require gotenberg/gotenberg-php:3.9.0 php-http/guzzle7-adapter:1.1.0You should see: Composer list each package it installs, among them - Installing gotenberg/gotenberg-php (v3.9.0): Extracting archive.
Step 3. Make a small price list
printf 'Item,Qty,Price\nTea,2,3.50\nCoffee,1,4.20\n' > prices.csvYou should see: nothing printed; the folder now holds prices.csv.
Step 4. Write the program
The program is the same as for version 2. Save it as convert.php:
<?php
require __DIR__ . '/vendor/autoload.php';
use Gotenberg\Gotenberg;
use Gotenberg\Stream;
$address = 'http://localhost:3000';
$invoice = Gotenberg::chromium($address)
->pdf()
->outputFilename('invoice')
->html(Stream::string('index.html', '<h1>Invoice 1001</h1><p>Thank you for your order.</p>'));
Gotenberg::save($invoice, __DIR__);
$prices = Gotenberg::libreOffice($address)
->outputFilename('prices')
->convert(Stream::path(__DIR__ . '/prices.csv'));
Gotenberg::save($prices, __DIR__);
echo "Saved invoice.pdf and prices.pdf\n";Step 5. Run it, then stop Marqius Kern
php convert.php
docker stop kernYou should see:
Saved invoice.pdf and prices.pdf
kernThere are now two new files in the folder: invoice.pdf, with the heading Invoice 1001, and prices.pdf, with the price list.
If it does not work:
docker runsays the namekernis already in use: a container left from an earlier try still has it. Remove it withdocker rm -f kern, then start again from step 1.docker runsays port 3000 is already allocated or in use: another server listens on it, often your old Gotenberg. Stop that first (docker pslists the running containers).- The
curlcommand in step 1 gives up with an error:docker logs kernshows Marqius Kern's messages. - Composer stops because a PHP extension is missing (it names it, beginning
ext-): install that extension for your PHP, then run the command again. On Ubuntu, the packagesphp-cli php-xml php-curl php-mbstring php-zip php-intl php-sqlite3 composer unzip gitgive PHP everything the PHP examples in this guide use.
What differs from Gotenberg:
- Version 2: its own tests check the requests it builds against a stand-in, not a server; two applications that print through it, solidtime (gotenberg-php 2.25) and InvoiceShelf (2.26), pass their PDF tests against Marqius Kern as against Gotenberg.
- Version 3: every Gotenberg 9 operation is answered. What Marqius Kern does not do yet is answered 501, with the reason: on the LibreOffice route,
paperSize(),paperDimensions(),locale()andshowTrackedChanges(); on a signed PDF, the edits Gotenberg 9 adds to it as an update (rotating pages, setting metadata or bookmarks, attaching or removing files, autotagging; stamps are added as Gotenberg adds them, and the signatures stay); and remediation to PDF/A-4e. - Version 3: a text watermark (
nativeWatermarkText()) is drawn on every page, but reading the page's text does not return its words, as it does from Gotenberg's PDF.
What to check after switching:
Gotenberg::save()names each file from the server'sContent-Dispositionheader, which Marqius Kern sends as Gotenberg does: the names you set withoutputFilename()stay;- with version 3, keep
KERN_GOTENBERG_VERSION=9.10.3in the server's environment, and look in your logs for answers with status 501: each names one of the operations above.
The Symfony bundle, in a new application.
The bundle calls the base_uri of its HTTP client, which its Flex recipe sets from GOTENBERG_DSN in .env; that setting stays as it is. Version 1.4.0 speaks Gotenberg 8's API.
You need: Docker, curl, PHP 8.2 or later and Composer.
It takes: about 10 minutes.
Step 1. Start Marqius Kern
In a new, empty folder, start Marqius Kern and wait until it answers. The first command starts it in the background, as a container named kern on port 3000; the second asks its health check until it answers.
docker run --rm -d --name kern -p 3000:3000 marqius/kern
curl -sS --fail --retry 10 --retry-delay 1 --retry-all-errors http://localhost:3000/healthYou should see: a long string of letters and digits (the container's ID), then a line that begins {"status":"up".
Step 2. Make a new Symfony application
This makes a new Symfony application in a folder named invoices, and goes into it.
composer create-project "symfony/skeleton:7.4.*" invoices
cd invoicesYou should see: Composer install Symfony, then end with Symfony's notes under What's next?, which this example does not need.
Step 3. Add the bundle
The bundle's recipe (the set-up Symfony Flex runs when a package is added) is a community (contrib) recipe, so the first command allows those. The second adds Symfony's HTTP client and the bundle, version 1.4.0; the recipe writes GOTENBERG_DSN=http://gotenberg:3000 in .env. If Composer asks whether to include the recipe's Docker configuration, either answer works here.
composer config extra.symfony.allow-contrib true
composer require symfony/http-client sensiolabs/gotenberg-bundle:1.4.0You should see: Composer install the bundle (- Installing sensiolabs/gotenberg-bundle (v1.4.0): Extracting archive), then the recipe's note * Do not forget to start the new Gotenberg container if enabled. Here, Marqius Kern from step 1 is that container.
Step 4. Point the bundle at Marqius Kern
.env.local overrides .env on your machine. This one points the example at Marqius Kern on port 3000.
echo 'GOTENBERG_DSN=http://localhost:3000' > .env.localYou should see: nothing printed.
Step 5. Make a small price list
The price list goes in assets/, where the bundle looks for files, for the LibreOffice route.
mkdir assets
printf 'Item,Qty,Price\nTea,2,3.50\nCoffee,1,4.20\n' > assets/prices.csvYou should see: nothing printed.
Step 6. Write a console command
A console command that makes both PDFs. Save it as src/Command/InvoiceCommand.php:
<?php
namespace App\Command;
use Sensiolabs\GotenbergBundle\GotenbergPdfInterface;
use Sensiolabs\GotenbergBundle\Processor\FileProcessor;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\DependencyInjection\Attribute\Autowire;
use Symfony\Component\Filesystem\Filesystem;
#[AsCommand(name: 'app:invoice', description: 'Makes invoice.pdf and prices.pdf')]
final class InvoiceCommand extends Command
{
public function __construct(
private readonly GotenbergPdfInterface $gotenberg,
#[Autowire('%kernel.project_dir%')]
private readonly string $projectDir,
) {
parent::__construct();
}
protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->gotenberg->html()
->contentRaw('<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><title>Invoice 1001</title></head><body><h1>Invoice 1001</h1><p>Thank you for your order.</p></body></html>')
->fileName('invoice')
->processor(new FileProcessor(new Filesystem(), $this->projectDir))
->generate()
->process();
$this->gotenberg->office()
->files('prices.csv')
->fileName('prices')
->processor(new FileProcessor(new Filesystem(), $this->projectDir))
->generate()
->process();
$output->writeln('Saved invoice.pdf and prices.pdf');
return Command::SUCCESS;
}
}Step 7. Run it, then stop Marqius Kern
php bin/console app:invoice
docker stop kernYou should see:
Saved invoice.pdf and prices.pdf
kernThere are now two new files in the invoices folder: invoice.pdf, with the heading Invoice 1001, and prices.pdf, with the price list.
If it does not work:
docker runsays the namekernis already in use: a container left from an earlier try still has it. Remove it withdocker rm -f kern, then start again from step 1.docker runsays port 3000 is already allocated or in use: another server listens on it, often your old Gotenberg. Stop that first (docker pslists the running containers).- The
curlcommand in step 1 gives up with an error:docker logs kernshows Marqius Kern's messages. - Composer stops because a PHP extension is missing (it names it, beginning
ext-): install that extension for your PHP, then run the command again. On Ubuntu, the packagesphp-cli php-xml php-curl php-mbstring php-zip php-intl php-sqlite3 composer unzip gitgive PHP everything the PHP examples in this guide use.
What differs from Gotenberg: The client tests use a stand-in for the server, so they do not establish server compatibility. Use the example above to check the integration in your environment.
What to check after switching:
- if you let Flex add the recipe's Docker configuration,
compose.yamlhas agotenbergservice with the imagegotenberg/gotenberg:8: that image line is the one to change (the switching guide's Docker Compose section), andGOTENBERG_DSNstays; - a Twig template that uses
gotenberg_asset()sends its pictures and style sheets with the page: convert one such document and compare it withupgrade-check(the switching guide's first section).
laravel-pdf, in a new application.
With LARAVEL_PDF_DRIVER=gotenberg, laravel-pdf calls GOTENBERG_URL (the config key laravel-pdf.gotenberg.url); both stay as they are.
You need: Docker, curl, PHP 8.3 or later and Composer.
It takes: about 10 minutes.
Step 1. Start Marqius Kern
In a new, empty folder, start Marqius Kern and wait until it answers. The first command starts it in the background, as a container named kern on port 3000; the second asks its health check until it answers.
docker run --rm -d --name kern -p 3000:3000 marqius/kern
curl -sS --fail --retry 10 --retry-delay 1 --retry-all-errors http://localhost:3000/healthYou should see: a long string of letters and digits (the container's ID), then a line that begins {"status":"up".
Step 2. Make a new Laravel application
This makes a new Laravel application in a folder named invoices, and goes into it.
composer create-project "laravel/laravel:^13.0" invoices
cd invoicesYou should see: Composer install Laravel, then Laravel set the new application up, with lines such as Application key set successfully. and its first database tables marked DONE.
Step 3. Add laravel-pdf
This adds laravel-pdf, version 2.14.0.
composer require spatie/laravel-pdf:2.14.0You should see: Composer install laravel-pdf, then Laravel list the packages it found, spatie/laravel-pdf among them, each marked DONE.
Step 4. Point its Gotenberg driver at Marqius Kern
This adds two lines to .env: LARAVEL_PDF_DRIVER=gotenberg chooses laravel-pdf's Gotenberg driver, and GOTENBERG_URL gives Marqius Kern's address.
printf '\nLARAVEL_PDF_DRIVER=gotenberg\nGOTENBERG_URL=http://localhost:3000\n' >> .envYou should see: nothing printed.
Step 5. Write an Artisan command
An Artisan command that makes the invoice. Save it as app/Console/Commands/PrintInvoice.php (Laravel finds commands in this folder by itself):
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Spatie\LaravelPdf\Facades\Pdf;
class PrintInvoice extends Command
{
protected $signature = 'invoice:print';
protected $description = 'Makes invoice.pdf';
public function handle(): void
{
Pdf::html('<h1>Invoice 1001</h1><p>Thank you for your order.</p>')
->format('a4')
->save(base_path('invoice.pdf'));
$this->info('Saved invoice.pdf');
}
}Step 6. Run it, then stop Marqius Kern
php artisan invoice:print
docker stop kernYou should see:
Saved invoice.pdf
kernThere is now a new file in the invoices folder: invoice.pdf, with the heading Invoice 1001.
If it does not work:
docker runsays the namekernis already in use: a container left from an earlier try still has it. Remove it withdocker rm -f kern, then start again from step 1.docker runsays port 3000 is already allocated or in use: another server listens on it, often your old Gotenberg. Stop that first (docker pslists the running containers).- The
curlcommand in step 1 gives up with an error:docker logs kernshows Marqius Kern's messages. - Composer stops because a PHP extension is missing (it names it, beginning
ext-): install that extension for your PHP, then run the command again. On Ubuntu, the packagesphp-cli php-xml php-curl php-mbstring php-zip php-intl php-sqlite3 composer unzip gitgive PHP everything the PHP examples in this guide use.
What differs from Gotenberg: No differences were reported in the library tests referenced below. Those results do not establish identical output for every document.
What to check after switching:
- a view that waits with
waitUntilReady()for a chart drawn by JavaScript: Marqius Kern runs scripts that build the page but has no canvas to draw on (the switching guide's first section), so convert that view first; - with
GOTENBERG_USERNAMEandGOTENBERG_PASSWORDset, start Marqius Kern as you started Gotenberg:--api-enable-basic-authwith theGOTENBERG_API_BASIC_AUTH_USERNAMEandGOTENBERG_API_BASIC_AUTH_PASSWORDvariables.
Compatibility results
The public Marqius compatibility scoreboard reports these results for Marqius Kern 0.12.18, tested on 30 November 2026 and reviewed here on 2 December 2026. The counts cover the named libraries’ or applications’ assertions, not identical rendering of every customer PDF. Compare your own documents before switching.
Library and version | Pass on Gotenberg | Pass on Marqius Kern |
|---|---|---|
spatie/laravel-pdf 2.14.0's own tests | 14 | 14 |
See every test on the scoreboard
gotenberg-php and the Symfony bundle test against a stand-in for the server. Their own tests do not establish server compatibility; use the examples above to check your deployment. The application tests in the table cover only the assertions those applications make.
Licensing Marqius Kern
Personal, teaching and open-source use is free with a Community licence, including open-source projects' CI runs and documentation builds.
- Get your free key on the Marqius Kern licence page, then sign in with Google.
- Tick "I'll use Marqius Kern only for personal, teaching or open-source work".
- Get my free key, then Copy key.
- Set it as the variable
MARQIUS_LICENCEon your server.
Anything done by or for a business, including internal tools and client work, needs a paid licence. See the plans and prices.
Deploy Marqius Kern on Railway
For a hosted PDF server, start with the Marqius Kern deployment template on Railway. The examples in this guide run locally; when using Railway, configure your client with the service’s HTTPS address and the generated credentials shown in its Variables tab.
Deploy Marqius Kern on Railway
Before you switch
Compare your own documents side by side first, as the switching guide shows, then switch.
Reader questions
Does gotenberg-php work with Marqius Kern?
Yes, both versions: gotenberg-php 2, written for Gotenberg 8, and gotenberg-php 3, written for Gotenberg 9. Marqius Kern answers both APIs on one server.
Does laravel-pdf's Gotenberg driver work with Marqius Kern?
Yes. laravel-pdf's own tests, the 14 that pass against Gotenberg, pass against Marqius Kern on the public scoreboard. Its Gotenberg address stays as it is.
Does the Symfony GotenbergBundle work with Marqius Kern?
Yes. GOTENBERG_DSN stays as it is; the switch is the image line of your compose file.
How do I add my licence?
Personal, teaching and open-source use is free with a Community licence: get the key on the Marqius Kern licence page and set it as the variable MARQIUS_LICENCE on the server. Without a key, Marqius Kern makes the same documents and says in its log that it has none. Anything done by or for a business needs a paid licence.