PHP code example of masmaleki / zoho-v3

1. Go to this page and download the library: Download masmaleki/zoho-v3 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/ */

    

masmaleki / zoho-v3 example snippets


use Masmaleki\ZohoAllInOne\ZohoAllInOne;

$organizationId = 123456789;

$customField = ZohoAllInOne::createBooksCustomField([
    'label' => 'Internal Number',
    'data_type' => 'string',
], $organizationId);

$webhook = ZohoAllInOne::createBooksWebhook([
    'name' => 'Sales order sync',
    'url' => 'https://example.com/api/zoho/books/webhook',
], $organizationId);

$customFunction = ZohoAllInOne::createBooksCustomFunction([
    'name' => 'Sync sales order',
    'script' => '// Deluge script body',
], $organizationId);

$customAction = ZohoAllInOne::createBooksCustomAction([
    'name' => 'Run sync',
], $organizationId);

ZohoAllInOne::getBooksCustomFields($organizationId, $query = []);
ZohoAllInOne::createBooksCustomField($data, $organizationId);
ZohoAllInOne::getBooksCustomField($fieldId, $organizationId);
ZohoAllInOne::updateBooksCustomField($fieldId, $data, $organizationId);
ZohoAllInOne::deleteBooksCustomField($fieldId, $organizationId);

ZohoAllInOne::getBooksWebhooks($organizationId, $query = []);
ZohoAllInOne::createBooksWebhook($data, $organizationId);
ZohoAllInOne::getBooksWebhook($webhookId, $organizationId);
ZohoAllInOne::updateBooksWebhook($webhookId, $data, $organizationId);
ZohoAllInOne::deleteBooksWebhook($webhookId, $organizationId);

ZohoAllInOne::getBooksCustomFunctions($organizationId, $query = []);
ZohoAllInOne::createBooksCustomFunction($data, $organizationId);
ZohoAllInOne::getBooksCustomFunction($functionId, $organizationId);
ZohoAllInOne::updateBooksCustomFunction($functionId, $data, $organizationId);
ZohoAllInOne::deleteBooksCustomFunction($functionId, $organizationId);

ZohoAllInOne::getBooksCustomActions($organizationId, $query = []);
ZohoAllInOne::createBooksCustomAction($data, $organizationId);
ZohoAllInOne::getBooksCustomAction($actionId, $organizationId);
ZohoAllInOne::updateBooksCustomAction($actionId, $data, $organizationId);
ZohoAllInOne::deleteBooksCustomAction($actionId, $organizationId);

// Packages
ZohoAllInOne::listPackages($organizationId, $page = 1, $condition = '', $internalOrganizationId = null);
ZohoAllInOne::getPackage($packageId, $organizationId, $internalOrganizationId = null);
ZohoAllInOne::createPackage($salesOrderId, array $payload, $organizationId, $internalOrganizationId = null); // POST /packages?salesorder_id=
ZohoAllInOne::updatePackage($packageId, array $payload, $organizationId, $internalOrganizationId = null);
ZohoAllInOne::deletePackage($packageId, $organizationId, $internalOrganizationId = null);

// Shipment orders
ZohoAllInOne::getShipmentOrders($organizationId, $page = 1, $condition = '', $internalOrganizationId = null);
ZohoAllInOne::getShipmentOrder($shipmentOrderId, $organizationId, $internalOrganizationId = null);
ZohoAllInOne::createShipmentOrder(array $packageIds, $salesOrderId, array $payload, $organizationId, $internalOrganizationId = null); // POST /shipmentorders?package_ids=a,b&salesorder_id=
ZohoAllInOne::updateShipmentOrder($shipmentOrderId, array $payload, $organizationId, $internalOrganizationId = null);
ZohoAllInOne::deleteShipmentOrder($shipmentOrderId, $organizationId, $internalOrganizationId = null);
ZohoAllInOne::markShipmentOrderDelivered($shipmentOrderId, $organizationId, $internalOrganizationId = null); // POST /shipmentorders/{id}/status/delivered

// Purchase receives
ZohoAllInOne::getPurchaseReceives($organizationId, $page = 1, $condition = '', $internalOrganizationId = null);
ZohoAllInOne::getPurchaseReceive($purchaseReceiveId, $organizationId, $internalOrganizationId = null);
ZohoAllInOne::createPurchaseReceive($purchaseOrderId, array $payload, $organizationId, $internalOrganizationId = null); // POST /purchasereceives?purchaseorder_id=
ZohoAllInOne::updatePurchaseReceive($purchaseReceiveId, array $payload, $organizationId, $internalOrganizationId = null);
ZohoAllInOne::deletePurchaseReceive($purchaseReceiveId, $organizationId, $internalOrganizationId = null);

// Transfer orders
ZohoAllInOne::getTransferOrders($organizationId, $page = 1, $condition = '', $internalOrganizationId = null);
ZohoAllInOne::getTransferOrder($transferOrderId, $organizationId, $internalOrganizationId = null);
ZohoAllInOne::createTransferOrder(array $payload, $organizationId, $internalOrganizationId = null);
ZohoAllInOne::updateTransferOrder($transferOrderId, array $payload, $organizationId, $internalOrganizationId = null);
ZohoAllInOne::deleteTransferOrder($transferOrderId, $organizationId, $internalOrganizationId = null);
ZohoAllInOne::markTransferOrderTransferred($transferOrderId, $organizationId, $internalOrganizationId = null); // UNVERIFIED: POST /transferorders/{id}/markastransferred

// Inventory adjustments
ZohoAllInOne::getInventoryAdjustments($organizationId, $page = 1, $condition = '', $internalOrganizationId = null);
ZohoAllInOne::getInventoryAdjustment($inventoryAdjustmentId, $organizationId, $internalOrganizationId = null);
ZohoAllInOne::createInventoryAdjustment(array $payload, $organizationId, $internalOrganizationId = null);
ZohoAllInOne::deleteInventoryAdjustment($inventoryAdjustmentId, $organizationId, $internalOrganizationId = null);

// Item batches — UNVERIFIED endpoint: GET /items/{id}/batches, falling back to GET /items/{id} → item.batches
// on 404 / Zoho code 5; the result carries batches_source (batches_endpoint | item_detail | item_detail_without_batches).
ZohoAllInOne::getItemBatches($itemId, $organizationId, $internalOrganizationId = null);
bash
php artisan vendor:publish --tag="zoho-one-migrations"
php artisan migrate
bash
    php artisan vendor:publish --tag="zoho-one-migrations"
    php artisan migrate