PHP code example of sumer5020 / laravel-zoho-books
1. Go to this page and download the library: Download sumer5020/laravel-zoho-books 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/ */
sumer5020 / laravel-zoho-books example snippets
use Sumer5020\ZohoBooks\Facades\ZohoBooksFacade;
# or
use ZohoBooks;
$token = ZohoBooksFacade::authentications()->refreshAccessToken($refresh_token);
$status = ZohoBooksFacade::authentications()->revokeRefreshAccessToken($access_token, $refresh_token);
$contactData = new CreateContactDto([
'contact_name' => '...',
'company_name' => '...',
// ... other fields
]);
$response = ZohoBooksFacade::contacts()->create($token, $organizationId, $contactData);
$updateContactData = new UpdateContactDto([
'contact_name' => '...',
// ... other fields
]);
$response = ZohoBooksFacade::contacts()->update($token, $organizationId, $updateContactData);
$paginationDto = new PaginationDto(['page' => 1, 'per_page' => 10]);
$response = ZohoBooksFacade::contacts()->list($token, $organizationId, $paginationDto);
$contactId = '...';
$response = ZohoBooksFacade::contacts()->get($token, $organizationId, $contactId);
$response = ZohoBooksFacade::contacts()->delete($token, $organizationId, $contactId);
$contactPersonData = new CreateContactPersonDto([
'contact_id' => '...',
'first_name' => '...',
'last_name' => '...',
// ... other fields
]);
$response = ZohoBooksFacade::contactPersons()->create($token, $organizationId, $contactPersonData);
$updateContactPersonData = new UpdateContactPersonDto([
'contact_id' => '...',
'contact_person_id' => '...',
'first_name' => '...',
// ... other fields
]);
$response = ZohoBooksFacade::contactPersons()->update($token, $organizationId, $updateContactPersonData);
$paginationDto = new PaginationDto(['page' => 1, 'per_page' => 10]);
$response = ZohoBooksFacade::contactPersons()->list($token, $organizationId, $contactId, $paginationDto);
$getContactPersonDto = new GetContactPersonDto(['contact_id' => '...', 'contact_person_id' => '...']);
$response = ZohoBooksFacade::contactPersons()->get($token, $organizationId, $getContactPersonDto);
$response = ZohoBooksFacade::contactPersons()->delete($token, $organizationId, $contactPersonId);
$estimateData = new CreateEstimateDto([
'customer_id' => '...',
'currency_id' => '...',
// ... other fields
]);
$response = ZohoBooksFacade::Estimates()->create($token, $organizationId, $estimateData);
$updateEstimateData = new UpdateEstimateDto([
'estimate_id' => '...',
'customer_id' => '...',
// ... other fields
]);
$response = ZohoBooksFacade::Estimates()->update($token, $organizationId, $updateEstimateData);
$paginationDto = new PaginationDto(['page' => 1, 'per_page' => 10]);
$response = ZohoBooksFacade::Estimates()->list($token, $organizationId, $paginationDto);
$estimateId = 'estimate_id_here';
$response = ZohoBooksFacade::Estimates()->get($token, $organizationId, $estimateId);
$response = ZohoBooksFacade::Estimates()->delete($token, $organizationId, $estimateId);
$salesOrderData = new CreateSalesOrderDto([
'customer_id' => '...',
'currency_id' => '...',
// ... other fields
]);
$response = ZohoBooksFacade::salesOrders()->create($token, $organizationId, $salesOrderData);
$updateSalesOrderData = new UpdateSalesOrderDto([
'salesorder_id' => '...',
'customer_id' => '...',
// ... other fields
]);
$response = ZohoBooksFacade::salesOrders()->update($token, $organizationId, $updateSalesOrderData);
$paginationDto = new PaginationDto(['page' => 1, 'per_page' => 10]);
$response = ZohoBooksFacade::salesOrders()->list($token, $organizationId, $paginationDto);
$salesOrderId = '...';
$response = ZohoBooksFacade::salesOrders()->get($token, $organizationId, $salesOrderId);
$response = ZohoBooksFacade::salesOrders()->delete($token, $organizationId, $salesOrderId);
try {
// Your API call
} catch (Exception $e) {
// Handle the exception
echo 'Error: ' . $e->getMessage();
}
sh
php artisan vendor:publish --provider=Sumer5020\ZohoBooks\ZohoBooksServiceProvider
sh
php artisan vendor:publish --tag=zohoBooks.config
sh
php artisan vendor:publish --tag=zohoBooks.migrations
# Migrate the database
php artisan migrate