srdorado / siigo-client-php
Consumer client of the siigo api (https://siigoapi.docs.apiary.io/#)
Requires
- php: >=7.2
- guzzlehttp/guzzle: 7.5.0
- spatie/guzzle-rate-limiter-middleware: 2.0.1
Requires (Dev)
- phpunit/phpunit: ^8.5.31
- squizlabs/php_codesniffer: ^3.7
README
By srdorado
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.