承接 codeinc/cloudrun-gotenberg 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

codeinc/cloudrun-gotenberg

最新稳定版本:v1.4

Composer 安装命令:

composer require codeinc/cloudrun-gotenberg

包简介

Wrapper to use the Gotenberg HTTP client library with a CloudRun service

README 文档

README

The PHP 8.2+ library provides an authenticated Gotenberg client using codeinc/cloudrun-auth-http-client to be used with a Gotenberg service running on Google Cloud Platform Cloud Run.

Installation

The library is available on Packagist. You can install it using Composer:

composer require codeinc/cloudrun-gotenberg

Usage

This library is modeled after the official Gotenberg PHP client. The methods of the class CodeInc\CloudRunGotenberg\CloudRunGotenberg are the same as the Gotenberg\Gotenberg class (but they are not static).

The requests are authenticated using codeinc/cloudrun-auth-http-client. A service account is required to authenticate the requests. Check this page to learn how to create and authorized a service account and obtain the service account key.

The following conversion examples are extracted from Gotenberg PHP client documentation.

use CodeInc\CloudRunGotenberg\CloudRunGotenberg;
use Gotenberg\Stream;

// Creates the Cloud Run Gotenberg client 
$cloudRunGotenberg = new CloudRunGotenberg(
    // Cloud Run service URL
    'https://my-service-12345-uc.a.run.app',
    // path to your service account key or array of credentials 
    '/path/to/your/service-account-key.json' 
);

// Converts a target URL to PDF and saves it to a given directory.
$filename = $cloudRunGotenberg->save(
    $cloudRunGotenberg->chromium()->pdf()->url('https://my.url'), 
    $pathToSavingDirectory
);

// Converts Office documents to PDF and merges them.
$response = $cloudRunGotenberg->send(
    $cloudRunGotenberg->libreOffice()
        ->merge()
        ->convert(
            Stream::path($pathToDocx),
            Stream::path($pathToXlsx)
        )
);

License

The library is published under the MIT license (see LICENSE file).

统计信息

  • 总下载量: 46
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-02-03