teamfurther/fgo-php-sdk

FGO.ro API 的 PHP SDK 包装器。

1.0.0 2023-11-22 10:23 UTC

This package is auto-updated.

Last update: 2024-09-22 12:30:42 UTC


README

FGO PHP SDK 为使用 PHP 语言编写的应用程序提供了方便地访问 FGO API 的接口。

安装

您可以通过 composer 安装此包

composer require teamfurther/fgo-php-sdk

Tailwind 配置

此包包含一个默认的 Tailwind 配置。为了享受 Cinderblock 的所有功能,您应该复制并扩展此配置。

入门

示例用法

$client = new FGOClient(
    key: 'FGOKEY1234567890',
    merchantName: 'Your Company As Registered on FGO.ro Ltd.',
    merchantTaxId: 'RO12345678',
    platformUrl: $_SERVER['HTTP_HOST'],
    environment: FGOClient::ENV_PRODUCTION,
);

$invoice = $client->invoice->create([
    'Client' => [
        'CodUnic' => '79792323',
        'Denumire' => 'Client SRL',
        'Tip' => 'PJ',
    ],
    'Continut' => [
        [
            'Denumire' => 'Abonament',
            'NrProduse' => 1,
            'PretUnitar' => 45,
            'CotaTVA' => 19,
            'UM' => 'lună',
        ],
    ],
    'Serie' => 'KOMPZT',
    'TipFactura' => 'Factura',
    'Valuta' => 'RON',
]);

注意:您不需要在每次请求的请求体中包含 CodUnicPlatformaURL 的值。这些值将从初始客户端配置中自动附加。

同样,您也不必包含 Hash。这将被自动生成并附加到请求体中。

如果您包含这些值,它们将覆盖默认的客户端配置。

可用方法

有关更多信息,请查看 FGO API