定制 srdorado/siigo-client-php 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

srdorado/siigo-client-php

最新稳定版本:v0.8.5

Composer 安装命令:

composer require srdorado/siigo-client-php

包简介

Consumer client of the siigo api (https://siigoapi.docs.apiary.io/#)

README 文档

README

By srdorado

License Packagist PHP Version Support Packagist Version Packagist Downloads Composer dependencies Test workflow Codecov composer.lock

This library consumes the Siigo API enabling:

  • Create, update and consult Sales Invoices.

  • Sending sales invoices to the Dian and customers.

  • Create, consult, update and delete Clients (Third Parties) and Products/Services.

  • Create and consult Accounting Receipts, Credit Notes and Cash Receipts.

  • Consult Inventory of a product in Siigo Cloud.

Installation

composer require srdorado/siigo-client-php

How to use it?

  • Get token
    function getToken()
    {
        // Create client token
        $clientFactory = new \Srdorado\SiigoClient\Factory\ClientFactory();
        $clientTokenFactory = $clientFactory->create(\Srdorado\SiigoClient\Enum\ClientType::TOKEN);
        $clientToken = $clientTokenFactory->create();
        $clientToken->setBaseUrl('https://api.siigo.com/');

        // Create entity token
        $entity = new \Srdorado\SiigoClient\Model\Entity(\Srdorado\SiigoClient\Enum\ClientType::TOKEN);
        $entity->setData(
            [
                'username' => '',
                'access_key' => ''
            ]
        );

        // Request token
        return $clientToken->getToken($entity);
    }
  • Create product
    function getCustomClient()
    {
        // generate token
        $token = $this->getToken();

        // Create client
        $clientFactory = new \Srdorado\SiigoClient\Factory\ClientFactory();
        $clientProductFactory = $clientFactory->create(\Srdorado\SiigoClient\Enum\ClientType::PRODUCT);
        $clientProduct = $clientProductFactory->create();
        $clientProduct->setBaseUrl('https://api.siigo.com/');
        $clientProduct->setAccessKey($token);


        return $clientProduct;
    }



    function create()
    {
        $clientProduct = $this->getCustomClient();

        $entity = new \Srdorado\SiigoClient\Model\Entity(\Srdorado\SiigoClient\Enum\ClientType::PRODUCT);

        $dataEntity = $this->getExampleCompleteProduct();

        $entity->setData($dataEntity);

        $productId = $clientProduct->create($entity);

        $this->assertTrue(true);
    }

Versioning

Version numbers follow the MAJOR.MINOR.PATCH scheme. Backwards compatibility breaking changes will be kept to a minimum but be aware that these can occur. Lock your dependencies for production and test your code when upgrading.

License

This bundle is under the MIT license. For the full copyright and license information please view the LICENSE file that was distributed with this source code.

Donations

paypal

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-10-09