NextPDF Artisan の統合
nextpdf/artisan はフレームワークのプラグインではなく、ライブラリです。統合するには、インストールしたうえで ChromeRendererConfig を NextPDF ドキュメントにアタッチし、writeHtmlChrome() を呼び出します。このページでは、Artisan に関する他のドキュメントへの導線を示します。
インストール
「インストール」という見出しのセクションcomposer require nextpdf/artisan要件の全体マトリクスと外部の Chrome 依存関係については、次を参照してください: /integrations/artisan/install/.
ブートとディスカバリー
「ブートとディスカバリー」という見出しのセクションArtisan には、サービスプロバイダー、バンドル、フレームワーク向けの自動ディスカバリーマニフェストは含まれていません。これは、直接利用するシンプルな PSR-4 ライブラリ(NextPDF\Artisan\、NextPDF\Parser\)です。「ディスカバリー」する対象はありません。エントリポイントは writeHtmlChrome() メソッドです。ブリッジクラスがオートロード可能になると、nextpdf/core が Document 上に公開します。ディスカバリーとブートストラップのモデルについては、次を参照してください: /integrations/artisan/boot-and-discovery/.
コンテナーのバインディング
「コンテナーのバインディング」という見出しのセクション公開対象となるコンテナー統合はありません。DI コンテナーを使わない環境向けに、EInvoiceServiceFactory は静的ファクトリーメソッド(makeEmbedder、makeValidator、makeDefaultProfile、makeSchematronRunner)を提供します。これらのメソッドは、Premium の e-invoice コントラクト実装を返します。Premium ティアがインストールされていない場合は null を返します。これは、フレームワークラッパーパッケージにおける null 返却の動作を反映したもので、コンテナーを使用しないコードでも一貫したインターフェイスを利用できます。詳細と設計上の根拠については、次を参照してください: /integrations/artisan/boot-and-discovery/.
公開 API のエントリポイント
「公開 API のエントリポイント」という見出しのセクション| エントリポイント | 所在 | ドキュメント |
|---|---|---|
Document::writeHtmlChrome()(core メソッド) | nextpdf/core | クイックスタート: /integrations/artisan/quickstart/ |
Document::setChromeRendererConfig()(core メソッド) | 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/ |
メソッド writeHtmlChrome() のシグネチャは (string $html, ?float $width = null, ?float $height = null): static で、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";これは、オートロードと nextpdf/core のコントラクトバインディングが、Chrome を起動せずに resolve(解決)されることを示します(この動作は tests/Unit/Artisan/ChromeHtmlRendererTest.php::usesDefaultHtmlSecurityPolicyWhenNoneInjected でアサートされています)。実際に Chrome を使用するエンドツーエンドのレンダリングスモークテストについては、次を参照してください: /integrations/artisan/chrome-renderer-setup/.
次のステップ
「次のステップ」という見出しのセクション- 最初のドキュメントのレンダリング: /integrations/artisan/quickstart/
- すべての構成オプション: /integrations/artisan/configuration/
- Chrome / コンテナーのプロビジョニング: /integrations/artisan/chrome-renderer-setup/
- トランスポートと分離のモデル: /integrations/artisan/security-and-operations/
- 本番環境での接続とバッチワーカー: /integrations/artisan/production-usage/
- 障害の診断: /integrations/artisan/troubleshooting/
- パッケージのブートの仕組み: /integrations/artisan/boot-and-discovery/
商用版のコンテキスト
「商用版のコンテキスト」という見出しのセクションこのブリッジは、完全に機能するオープンソース実装です。Premium ティアでは、レンダリングされた PDF に e-invoice の埋め込み(Pro)と検証(Enterprise)を追加します。これらが存在しない場合、EInvoiceServiceFactory は null にフォールバックします。そのため、統合コードを一度書けば、Premium の有無にかかわらず実行できます。
- 概要ページ: /integrations/artisan/overview/
- インストール: /integrations/artisan/install/
- ブートとディスカバリー: /integrations/artisan/boot-and-discovery/
- クイックスタート: /integrations/artisan/quickstart/