PHP code example of unified / unified-to

1. Go to this page and download the library: Download unified/unified-to library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

unified / unified-to example snippets


declare(strict_types=1);

use Unified\Unified_to\Models\Operations;
use Unified\Unified_to\Models\Shared;
use Unified\Unified_to\Utils;

$sdk = Unified_to\UnifiedTo::builder()
    ->setSecurity(
        '<YOUR_API_KEY_HERE>'
    )
    ->build();

$request = new Operations\CreateAccountingAccountRequest(
    accountingAccount: new Shared\AccountingAccount(
        balance: 12092,
        createdAt: Utils\Utils::parseDateTime('2022-07-03T17:57:07.391Z'),
        currency: 'BOB',
        customerDefinedCode: 'quo',
        description: 'Spoliatio comedo vilitas harum cupiditate.',
        id: '17197349-fb2b-49f6-9196-53d6fe02ce9d',
        isPayable: true,
        name: 'Electronic Aluminum Tuna',
        status: Shared\Status::Archived,
        taxonomy: [
            new Shared\AccountingAccountTaxonomy(
                originalType: 'vesper',
                type: Shared\AccountingAccountTaxonomyType::Subgroup,
                value: 'iste',
            ),
            new Shared\AccountingAccountTaxonomy(
                originalType: 'adamo',
                type: Shared\AccountingAccountTaxonomyType::Subgroup,
                value: 'peccatus',
            ),
        ],
        type: Shared\Type::Bank,
        updatedAt: Utils\Utils::parseDateTime('2023-01-03T06:08:54.340Z'),
    ),
    connectionId: '<id>',
);

$response = $sdk->accounting->createAccountingAccount(
    request: $request
);

if ($response->accountingAccount !== null) {
    // handle response
}

declare(strict_types=1);

use Unified\Unified_to\Models\Operations;
use Unified\Unified_to\Models\Shared;
use Unified\Unified_to\Utils;

$sdk = Unified_to\UnifiedTo::builder()
    ->setSecurity(
        '<YOUR_API_KEY_HERE>'
    )
    ->build();

$request = new Operations\CreateAccountingAccountRequest(
    accountingAccount: new Shared\AccountingAccount(
        balance: 12092,
        createdAt: Utils\Utils::parseDateTime('2022-07-03T17:57:07.391Z'),
        currency: 'BOB',
        customerDefinedCode: 'quo',
        description: 'Spoliatio comedo vilitas harum cupiditate.',
        id: '17197349-fb2b-49f6-9196-53d6fe02ce9d',
        isPayable: true,
        name: 'Electronic Aluminum Tuna',
        status: Shared\Status::Archived,
        taxonomy: [
            new Shared\AccountingAccountTaxonomy(
                originalType: 'vesper',
                type: Shared\AccountingAccountTaxonomyType::Subgroup,
                value: 'iste',
            ),
            new Shared\AccountingAccountTaxonomy(
                originalType: 'adamo',
                type: Shared\AccountingAccountTaxonomyType::Subgroup,
                value: 'peccatus',
            ),
        ],
        type: Shared\Type::Bank,
        updatedAt: Utils\Utils::parseDateTime('2023-01-03T06:08:54.340Z'),
    ),
    connectionId: '<id>',
);

$response = $sdk->accounting->createAccountingAccount(
    request: $request
);

if ($response->accountingAccount !== null) {
    // handle response
}

declare(strict_types=1);

use Unified\Unified_to\Models\Operations;
use Unified\Unified_to\Models\Shared;
use Unified\Unified_to\Utils;

$sdk = Unified_to\UnifiedTo::builder()
    ->setSecurity(
        '<YOUR_API_KEY_HERE>'
    )
    ->build();

try {
    $request = new Operations\CreateAccountingAccountRequest(
        accountingAccount: new Shared\AccountingAccount(
            balance: 12092,
            createdAt: Utils\Utils::parseDateTime('2022-07-03T17:57:07.391Z'),
            currency: 'BOB',
            customerDefinedCode: 'quo',
            description: 'Spoliatio comedo vilitas harum cupiditate.',
            id: '17197349-fb2b-49f6-9196-53d6fe02ce9d',
            isPayable: true,
            name: 'Electronic Aluminum Tuna',
            status: Shared\Status::Archived,
            taxonomy: [
                new Shared\AccountingAccountTaxonomy(
                    originalType: 'vesper',
                    type: Shared\AccountingAccountTaxonomyType::Subgroup,
                    value: 'iste',
                ),
                new Shared\AccountingAccountTaxonomy(
                    originalType: 'adamo',
                    type: Shared\AccountingAccountTaxonomyType::Subgroup,
                    value: 'peccatus',
                ),
            ],
            type: Shared\Type::Bank,
            updatedAt: Utils\Utils::parseDateTime('2023-01-03T06:08:54.340Z'),
        ),
        connectionId: '<id>',
    );

    $response = $sdk->accounting->createAccountingAccount(
        request: $request
    );

    if ($response->accountingAccount !== null) {
        // handle response
    }
} catch (Errors\SDKException $e) {
    // handle default exception
    throw $e;
}

declare(strict_types=1);

use Unified\Unified_to\Models\Operations;
use Unified\Unified_to\Models\Shared;
use Unified\Unified_to\Utils;

$sdk = Unified_to\UnifiedTo::builder()
    ->setServerIndex(0)
    ->setSecurity(
        '<YOUR_API_KEY_HERE>'
    )
    ->build();

$request = new Operations\CreateAccountingAccountRequest(
    accountingAccount: new Shared\AccountingAccount(
        balance: 12092,
        createdAt: Utils\Utils::parseDateTime('2022-07-03T17:57:07.391Z'),
        currency: 'BOB',
        customerDefinedCode: 'quo',
        description: 'Spoliatio comedo vilitas harum cupiditate.',
        id: '17197349-fb2b-49f6-9196-53d6fe02ce9d',
        isPayable: true,
        name: 'Electronic Aluminum Tuna',
        status: Shared\Status::Archived,
        taxonomy: [
            new Shared\AccountingAccountTaxonomy(
                originalType: 'vesper',
                type: Shared\AccountingAccountTaxonomyType::Subgroup,
                value: 'iste',
            ),
            new Shared\AccountingAccountTaxonomy(
                originalType: 'adamo',
                type: Shared\AccountingAccountTaxonomyType::Subgroup,
                value: 'peccatus',
            ),
        ],
        type: Shared\Type::Bank,
        updatedAt: Utils\Utils::parseDateTime('2023-01-03T06:08:54.340Z'),
    ),
    connectionId: '<id>',
);

$response = $sdk->accounting->createAccountingAccount(
    request: $request
);

if ($response->accountingAccount !== null) {
    // handle response
}

declare(strict_types=1);

use Unified\Unified_to\Models\Operations;
use Unified\Unified_to\Models\Shared;
use Unified\Unified_to\Utils;

$sdk = Unified_to\UnifiedTo::builder()
    ->setServerURL('https://api-au.unified.to')
    ->setSecurity(
        '<YOUR_API_KEY_HERE>'
    )
    ->build();

$request = new Operations\CreateAccountingAccountRequest(
    accountingAccount: new Shared\AccountingAccount(
        balance: 12092,
        createdAt: Utils\Utils::parseDateTime('2022-07-03T17:57:07.391Z'),
        currency: 'BOB',
        customerDefinedCode: 'quo',
        description: 'Spoliatio comedo vilitas harum cupiditate.',
        id: '17197349-fb2b-49f6-9196-53d6fe02ce9d',
        isPayable: true,
        name: 'Electronic Aluminum Tuna',
        status: Shared\Status::Archived,
        taxonomy: [
            new Shared\AccountingAccountTaxonomy(
                originalType: 'vesper',
                type: Shared\AccountingAccountTaxonomyType::Subgroup,
                value: 'iste',
            ),
            new Shared\AccountingAccountTaxonomy(
                originalType: 'adamo',
                type: Shared\AccountingAccountTaxonomyType::Subgroup,
                value: 'peccatus',
            ),
        ],
        type: Shared\Type::Bank,
        updatedAt: Utils\Utils::parseDateTime('2023-01-03T06:08:54.340Z'),
    ),
    connectionId: '<id>',
);

$response = $sdk->accounting->createAccountingAccount(
    request: $request
);

if ($response->accountingAccount !== null) {
    // handle response
}