Skip to content

NextPDF Artisan integration

nextpdf/artisan is a library, not a framework plugin. To integrate it, install it, attach a ChromeRendererConfig to a NextPDF document, and call writeHtmlChrome(). Use this page to find the rest of the Artisan documentation.

Terminal window
composer require nextpdf/artisan

For the full requirement matrix and the external Chrome dependency, see /integrations/artisan/install/.

Artisan ships no service provider, bundle, or framework auto-discovery manifest. It is a plain PHP Standard Recommendation 4 (PSR-4) library (NextPDF\Artisan\, NextPDF\Parser\) that you consume directly. There is nothing to discover. The entry point is the writeHtmlChrome() method, which nextpdf/core exposes on Document after the bridge classes are autoloadable. For the discovery and bootstrap model, see /integrations/artisan/boot-and-discovery/.

There is no container integration to publish. In environments without a dependency injection container, EInvoiceServiceFactory provides static factory methods (makeEmbedder, makeValidator, makeDefaultProfile, makeSchematronRunner). These methods return Premium e-invoice contract implementations, or null when the Premium tier is not installed. This mirrors the null-return behavior of the framework wrapper packages, so code without a container uses the same surface. For details and rationale, see /integrations/artisan/boot-and-discovery/.

Entry pointWhereDocumented in
Document::writeHtmlChrome() (core method)nextpdf/core/integrations/artisan/quickstart/
Document::setChromeRendererConfig() (core method)nextpdf/core/integrations/artisan/quickstart/
ChromeHtmlRenderer::render()nextpdf/artisan/integrations/artisan/production-usage/
ChromeRendererConfig / ::fromArray()nextpdf/artisan/integrations/artisan/configuration/
EInvoiceServiceFactory::make*()nextpdf/artisan/integrations/artisan/boot-and-discovery/

The writeHtmlChrome() signature is (string $html, ?float $width = null, ?float $height = null): static, as verified against nextpdf/coresrc/Core/Concerns/HasTextOutput.php.

<?php
declare(strict_types=1);
use NextPDF\Artisan\ChromeHtmlRenderer;
use NextPDF\Artisan\ChromeRendererConfig;
require __DIR__ . '/vendor/autoload.php';
$renderer = new ChromeHtmlRenderer(new ChromeRendererConfig());
assert($renderer->getHtmlSecurityPolicy()->getName() === 'default');
echo "ARTISAN_WIRED\n";

This proves that autoloading and the nextpdf/core contract bindings resolve without launching Chrome (behavior asserted by tests/Unit/Artisan/ChromeHtmlRendererTest.php::usesDefaultHtmlSecurityPolicyWhenNoneInjected). For the end-to-end render smoke test that runs Chrome, see /integrations/artisan/chrome-renderer-setup/.

  • Render your first document: /integrations/artisan/quickstart/
  • Every configuration option: /integrations/artisan/configuration/
  • Provision Chrome / containers: /integrations/artisan/chrome-renderer-setup/
  • The transport and isolation model: /integrations/artisan/security-and-operations/
  • Production wiring and batch workers: /integrations/artisan/production-usage/
  • Diagnose a failure: /integrations/artisan/troubleshooting/
  • How the package boots: /integrations/artisan/boot-and-discovery/

The bridge is fully functional open-source software. The Premium tiers add e-invoice embedding (Pro) and validation (Enterprise) on top of the rendered Portable Document Format (PDF) file. When they are absent, EInvoiceServiceFactory degrades to null, so you can write integration code once and run it with or without Premium.

  • /integrations/artisan/overview/
  • /integrations/artisan/install/
  • /integrations/artisan/boot-and-discovery/
  • /integrations/artisan/quickstart/