javiertelioz/facturama-php-sdk

Facturama SDK PHP

此包的规范仓库似乎已消失,因此该包已被冻结。

dev-master / 1.0.x-dev 2017-02-03 23:42 UTC

This package is auto-updated.

Last update: 2021-05-18 20:42:36 UTC


README

#Facturama SDK PHP

如何安装它?

composer install javiertelioz/facturama-php-sdk:^1.0@dev

包含库

将库包含到您的项目中

require __DIR__.'/vendor/autoload.php';

开始开发!

创建 Facturama\Api 类的实例

示例。

$facturama = new \Facturama\Api('USER', 'PASSWORD');

有了这个实例,您可以开始工作了。在这个阶段,您已经准备好代表用户调用 API。

执行 GET 调用

$params = [];
$result = $facturama->get('Client', $params);

执行 POST 调用

$params = [
  "Address" => [
    "Street" => "St One ",
    "ExteriorNumber" => "15",
    "InteriorNumber" => "12",
    "Neighborhood" => "Lower Manhattan, ",
    "ZipCode" => "sample string 5",
    "Locality" => "sample string 6",
    "Municipality" => "sample string 7",
    "State" => "sample string 8",
    "Country" => "MX"
  ],
  "Rfc" => "XEXX010101000",
  "Name" => "Test Test",
  "Email" => "test@facturma.com"
];
$result = $facturama->post('Client', $params);

执行 PUT 调用

$clientId = 'TGpJ_Ko32_ZSEPBcZXRnRw2';
$body = [
  "Id" => $clientId,
  "Address" => [
    "Street" => "St One",
    "ExteriorNumber" => "15",
    "InteriorNumber" => "12",
    "Neighborhood" => "Lower Manhattan, ",
    "ZipCode" => "sample string 5",
    "Locality" => "sample string 6",
    "Municipality" => "sample string 7",
    "State" => "sample string 8",
    "Country" => "MX"
  ],
  "Rfc" => "XEXX010101000",
  "Name" => "Test Test 2",
  "Email" => "test@facturma.com"
];

$result = $facturama->put('Client/' . $clientId, $body);

执行 DELETE 调用

$clientId = 'TGpJ_Ko32_ZSEPBcZXRnRw2';

$result = $facturama->delete('Client/' . $clientId);

示例

别忘了查看我们 examples 目录下的示例代码。

我想贡献力量!

太棒了!只需在 github 上 fork 项目。创建一个分支,编写一些代码,并为您的新代码添加一些测试。

感谢您的帮助!

## 贡献者: phansys