PHP code example of whitecube / winbooks-on-web-php-client
1. Go to this page and download the library: Download whitecube/winbooks-on-web-php-client 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/ */
whitecube / winbooks-on-web-php-client example snippets
use Whitecube\Winbooks\Winbooks;
// $access_token and $refresh_token can be null if you do not have them yet
$winbooks = new Winbooks($access_token, $refresh_token);
if(! $winbooks->authenticated()) {
[$access_token, $refresh_token] = $winbooks->authenticate($email, $exchange_token);
// Store the tokens somewhere safe
}
// Now you can start using the API
use Whitecube\Winbooks\Models\Logistics\DocumentHeader;
$query->join(DocumentHeader::class, function($join) {
$join->on('DocumentHeader_Id', '=', 'Some_Property')->alias('header');
});
$query->take(50);
$query->skip(50);
// Only take 50 results to display on the first page
$query->paginate(50);
// Query the 50 next results (on page 2)
$query->paginate(50, 2);
$winbooks->add('Customer', 'VLADIMIR', [
'Memo' => 'A Memo for Vladimir',
// ...
]);
// You can also add multiple objects at once:
$winbooks->addMany('Customers', [
[
'Code' => 'VLADIMIR',
'Memo' => 'A Memo for Vladimir',
// ...
],
[
'Code' => 'ALICE',
'Memo' => 'A Memo for Alice',
// ...
]
]);
use Whitecube\Winbooks\Models\Customer;
$vlad = new Customer(['Code' => 'VLADIMIR']);
$alice = new Customer(['Code' => 'ALICE']);
$winbooks->addModel($vlad);
// or multiple
$winbooks->addModels([$vlad, $alice]);
$winbooks->update('Customer', 'ALICE', [
'Memo' => 'This is an updated memo for Alice',
]);
// Or multiple
$winbooks->updateMany('Customers', [
[
'Code' => 'VLADIMIR',
'Memo' => 'This is an updated memo for Vladimir',
],
[
'Code' => 'ALICE',
'Memo' => 'This is an updated memo for Alice',
]
]);
$winbooks->delete('Customer', 'VLADIMIR');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.