1. Go to this page and download the library: Download lekoala/odoo-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/ */
use LeKoala\OdooClient\QueryOptions;
$page = $odoo->customers->list([], new QueryOptions(
limit: 50,
offset: 100,
order: 'name asc',
fields: ['id', 'name', 'email'],
context: ['lang' => 'fr_BE'],
));
foreach ($odoo->customers->iterate(
options: new QueryOptions(batchSize: 200, order: 'name asc'),
) as $customer) {
// The effective order is "name asc, id asc" for stable page boundaries.
}
use GuzzleHttp\Client;
use GuzzleHttp\Psr7\HttpFactory;
use LeKoala\OdooClient\Http\Psr18Transport;
use LeKoala\OdooClient\Config;
$guzzle = new Client([
'connect_timeout' => 5,
'timeout' => 30,
]);
$factory = new HttpFactory();
$config = (new Config($url, $db, $apiKey))->setHttpTransport(
new Psr18Transport($guzzle, $factory, $factory)
);
use LeKoala\OdooClient\Http\Psr18Transport;
use Nyholm\Psr7\Factory\Psr17Factory;
use Symfony\Component\HttpClient\HttpClient as SymfonyHttpClient;
use Symfony\Component\HttpClient\Psr18Client;
$psr18 = new Psr18Client(SymfonyHttpClient::create([
'timeout' => 30,
]));
$factory = new Psr17Factory();
$config->setHttpTransport(new Psr18Transport($psr18, $factory, $factory));
bash
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.