https://github.com/saulmoralespa/siigo-api-php
Library PHP Siigo
https://github.com/saulmoralespa/siigo-api-php
php sdk-php siigo siigo-nube
Last synced: 11 months ago
JSON representation
Library PHP Siigo
- Host: GitHub
- URL: https://github.com/saulmoralespa/siigo-api-php
- Owner: saulmoralespa
- License: mit
- Created: 2020-06-23T04:40:51.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2025-04-18T20:00:05.000Z (about 1 year ago)
- Last Synced: 2025-04-19T07:49:02.062Z (about 1 year ago)
- Topics: php, sdk-php, siigo, siigo-nube
- Language: PHP
- Homepage:
- Size: 11.7 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# siigo-api-php
SDK PHP API SIIGO
## Requirements
- PHP >= 8.1
- Composer
- SIIGO API credentials (username and access key)
## Installation ##
```bash
composer require saulmoralespa/siigo-api-php
```
## Basic Usage ##
```php
include_once __DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
use Saulmoralespa\Siigo\Client;
$username = 'YOUR_USERNAME';
$accessKey = 'YOUR_ACCESS_KEY';
$siigo = new Client($username, $accessKey);
// Get authentication token
$token = $siigo->getAccessToken();
// Set the token in the client
$filePath = __DIR__ . DIRECTORY_SEPARATOR . 'token.json';
$siigo->setTokenFilePath($filePath);
```
## Examples
### Create Invoice
```php
$invoiceData = [
"document" => [
"id" => 2372 // Get this ID from getDocumentTypes() method
],
"date" => date('Y-m-d'),
"customer" => [
"identification" => "123456789",
"branch_office" => 0
],
"seller" => 62, // Get this ID from getSellers() method
"stamp" => [
"send" => false // Set true to send to DIAN
],
"mail" => [
"send" => false // Set true to send to customer
],
"observations" => "Invoice observations",
"items" => [
[
"code" => "PROD-001",
"description" => "Test Product",
"quantity" => 1,
"price" => 12000
]
],
"payments" => [
[
"id" => 542, // Get this ID from getPaymentMethods() method
"value" => 12000,
"due_date" => date('Y-m-d')
]
]
];
$invoice = $siigo->createInvoice($invoiceData);
```