Ga naar inhoud

NextPDF Artisan-integratie

nextpdf/artisan is een library, geen framework-plug-in. Voor de integratie installeer je de library, koppel je een ChromeRendererConfig aan een NextPDF-document en roep je writeHtmlChrome() aan. Gebruik deze pagina om de rest van de Artisan-documentatie te vinden.

Terminal window
composer require nextpdf/artisan

Zie /integrations/artisan/install/ voor de volledige vereistenmatrix en de externe Chrome-afhankelijkheid.

Artisan levert geen service provider, bundle of framework-autodiscovery-manifest mee. Het is een gewone PHP Standard Recommendation 4 (PSR-4)-library (NextPDF\Artisan\, NextPDF\Parser\) die je rechtstreeks gebruikt. Er hoeft niets ontdekt te worden. Het toegangspunt is de methode writeHtmlChrome(), die via nextpdf/core beschikbaar is op Document zodra de bridge-klassen autoloadbaar zijn. Zie /integrations/artisan/boot-and-discovery/ voor het discovery- en bootstrapmodel.

Er is geen container-integratie om te publiceren. In omgevingen zonder dependency-injection-container biedt EInvoiceServiceFactory statische factory-methoden (makeEmbedder, makeValidator, makeDefaultProfile, makeSchematronRunner). Deze methoden retourneren Premium-implementaties van e-invoice-contracts, of null wanneer het Premium-niveau niet is geïnstalleerd. Dit weerspiegelt het null-retourgedrag van de framework-wrapper-packages, zodat code zonder container hetzelfde API-oppervlak gebruikt. Zie /integrations/artisan/boot-and-discovery/ voor details en achtergrond.

ToegangspuntWaarGedocumenteerd in
Document::writeHtmlChrome() (core-methode)nextpdf/core/integrations/artisan/quickstart/
Document::setChromeRendererConfig() (core-methode)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/

De signatuur van writeHtmlChrome() is (string $html, ?float $width = null, ?float $height = null): static, zoals geverifieerd aan de hand van 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";

Dit bewijst dat autoloading en de contract-bindings van nextpdf/core worden geresolved zonder Chrome te starten (gedrag bevestigd door tests/Unit/Artisan/ChromeHtmlRendererTest.php::usesDefaultHtmlSecurityPolicyWhenNoneInjected). Zie /integrations/artisan/chrome-renderer-setup/ voor de end-to-end-rendersmoke-test die Chrome start.

  • Render je eerste document: /integrations/artisan/quickstart/
  • Elke configuratieoptie: /integrations/artisan/configuration/
  • Chrome / containers inrichten: /integrations/artisan/chrome-renderer-setup/
  • Het transport- en isolatiemodel: /integrations/artisan/security-and-operations/
  • Productiebedrading en batchworkers: /integrations/artisan/production-usage/
  • Een storing diagnosticeren: /integrations/artisan/troubleshooting/
  • Hoe het package boot: /integrations/artisan/boot-and-discovery/

De bridge is volledig functionele opensourcesoftware. De Premium-niveaus voegen e-invoice-embedding (Pro) en -validatie (Enterprise) toe bovenop het gerenderde Portable Document Format (PDF)-bestand. Wanneer die ontbreken, valt EInvoiceServiceFactory terug op null, zodat je integratiecode één keer kunt schrijven en deze met of zonder Premium kunt uitvoeren.

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