PHPackages                             odxproxy/client - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. odxproxy/client

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

odxproxy/client
===============

High performance PHP client for ODXProxy

v0.1.0(1mo ago)03MITPHPPHP &gt;=8.1CI passing

Since May 25Pushed 1mo agoCompare

[ Source](https://github.com/terrakernel/ODXProxyClient-PHP)[ Packagist](https://packagist.org/packages/odxproxy/client)[ RSS](/packages/odxproxy-client/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

ODXProxy Client for PHP
=======================

[](#odxproxy-client-for-php)

[![Latest Version](https://camo.githubusercontent.com/69466b7e96f75eb9cd6c124d8fccf90fc3e2e0ec61ed038cb9cd2d04b8f40757/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f647870726f78792f636c69656e74)](https://packagist.org/packages/odxproxy/client)[![PHP Version](https://camo.githubusercontent.com/da8973d1f28f05164be859e18a565bc96b0f09ec36cc01c94b5e1e6cc9c887d5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6f647870726f78792f636c69656e74)](https://camo.githubusercontent.com/da8973d1f28f05164be859e18a565bc96b0f09ec36cc01c94b5e1e6cc9c887d5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6f647870726f78792f636c69656e74)[![License](https://camo.githubusercontent.com/3f1f86056dff376f9e3dd31a726bf070b7776482c2ba888d59224447ea789ff9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6f647870726f78792f636c69656e74)](https://camo.githubusercontent.com/3f1f86056dff376f9e3dd31a726bf070b7776482c2ba888d59224447ea789ff9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6f647870726f78792f636c69656e74)

A high-performance, low-footprint, zero-dependency PHP client for interacting with Odoo instances via the ODXProxy Gateway. This library is designed to be lightweight (using native curl and json extensions only) while maintaining strict type safety and security.

### Requirements

[](#requirements)

- PHP &gt;= 8.1
- Extensions: ext-curl, ext-json

### Installation

[](#installation)

```
composer require odxproxy/client
```

### Quick Start (Global Initialization)

[](#quick-start-global-initialization)

Similar to the Android SDK, you can initialize the client once (e.g., in your index.php, bootstrap.php, or Laravel AppServiceProvider). This sets up a Request-Scoped Singleton that allows you to access the API anywhere in your code without passing configuration arrays around.

```
use OdxProxy\Odx;

// 1. Initialize the client (do this once per request)
Odx::init([
    'gateway_url'     => 'https://gateway.odxproxy.io',
    'gateway_api_key' => 'YOUR_GATEWAY_KEY',
    'url'             => 'https://my-odoo-instance.com',
    'user_id'         => 1,
    'db'              => 'odoo_db',
    'api_key'         => 'ODOO_USER_API_KEY'
]);

// 2. Use it anywhere
try {
    // Fetch partners
    $partners = Odx::searchRead('res.partner', [['customer_rank', '>', 0]]);
    print_r($partners);
} catch (\OdxProxy\Exception\OdxException $e) {
    echo "Error {$e->getCode()}: {$e->getMessage()}";
}
```

Usage Guide
-----------

[](#usage-guide)

### 1. Reading Data

[](#1-reading-data)

#### searchRead

[](#searchread)

Combines searching and reading in one optimized call.

```
$domain = [['type', '=', 'invoice']];
$records = Odx::searchRead('account.move', $domain);
```

#### searchCount

[](#searchcount)

Get the number of records matching a domain.

```
$count = Odx::searchCount('sale.order', [['state', '=', 'sale']]);
```

#### read

[](#read)

Read specific fields from specific IDs.

```
$ids = [10, 11, 12];
$records = Odx::read('product.product', $ids);
```

### 2. Writing Data

[](#2-writing-data)

#### create

[](#create)

Creates a new record and returns the created ID (or record data depending on context).

```
$newId = Odx::create('res.partner', [
    'name' => 'John Doe',
    'email' => 'john@example.com'
]);
```

#### write

[](#write)

Updates existing records.

```
$success = Odx::write('res.partner', [55], [
    'phone' => '+15550001111'
]);
```

#### unlink (Delete)

[](#unlink-delete)

Deletes records.

```
$success = Odx::unlink('res.partner', [55]);
```

4. Calling Methods (RPC) Call any public method on an Odoo model.

```
// Example: Confirm a Sale Order
// Model: sale.order, Method: action_confirm, IDs: [100]
$result = Odx::call('sale.order', 'action_confirm', [[100]]);
```

Advanced Usage
--------------

[](#advanced-usage)

##### Pagination &amp; Filtering (KeywordRequest)

[](#pagination--filtering-keywordrequest)

Use the KeywordRequest helper to handle offset, limit, order, and fields (projection). This allows you to construct queries fluently.

```
use OdxProxy\Odx;
use OdxProxy\Model\KeywordRequest;

// Create options
$options = (new KeywordRequest())
    ->setLimit(5)
    ->setOffset(0)
    ->setOrder('name asc')
    ->setFields(['id', 'name', 'email']) // Only fetch these fields
    ->setContext([
        'lang' => 'en_US',
        'tz' => 'Asia/Jakarta',
        'allowed_company_ids' => [1],
        'default_company_id' => 1
    ]);

// Pass options as the last argument
$users = Odx::searchRead('res.users', [], $options);
```

Multi-User / SaaS Support (Odx::with) In Android, the device usually belongs to one user. In PHP, your server might handle requests for hundreds of different Odoo instances (Multi-tenancy). Do not use Odx::init() inside a loop, as it changes the global state. Instead, use Odx::with() to create a temporary, disposable client.

```
$tenants = [
    ['uid' => 1, 'db' => 'client_a', 'key' => '...'],
    ['uid' => 5, 'db' => 'client_b', 'key' => '...'],
];

foreach ($tenants as $tenant) {
    // Create a temporary client configuration
    $config = [
        'gateway_url'     => 'https://gateway.odxproxy.io',
        'gateway_api_key' => 'MASTER_KEY',
        'url'             => 'https://saas.odoo.com',
        'user_id'         => $tenant['uid'],
        'db'              => $tenant['db'],
        'api_key'         => $tenant['key']
    ];

    // Execute immediately without affecting global state
    $count = Odx::with($config)->searchCount('sale.order', []);

    echo "Client {$tenant['db']} has {$count} orders.\n";
}
```

### Error Handling

[](#error-handling)

The library throws OdxProxy\\Exception\\OdxException for both Network errors (Curl) and Odoo Server errors (XML-RPC/JSON-RPC faults).

```
use OdxProxy\Exception\OdxException;

try {
    Odx::create('res.partner', ['invalid_field' => 'value']);
} catch (OdxException $e) {
    // The HTTP Status Code (or 200 if Odoo returned a logic error)
    $code = $e->getCode();

    // The human readable message
    $msg  = $e->getMessage();

    // Detailed debug data (if available from Odoo)
    $data = $e->data;
}
```

Helper Classes Reference
------------------------

[](#helper-classes-reference)

> OdxProxy\\Model\\KeywordRequest

MethodDescriptionsetLimit(int)Max records to returnsetOffset(int)Number of records to skipsetOrder(string)Sort order (e.g., 'id desc')setFields(array)List of fields to return (SQL SELECT)resetPagination()Returns a copy of the request withlimit/offsetcleared> OdxProxy\\Utils\\IdHelper

MethodDescriptiongenerate()Generates a 13-byte random ID (similar to ULID) for request trackingnormalizeId($val)Robustly converts Odoo responses (which can be \[id, name\] or false) into a safe ID string or null.License MIT

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance92

Actively maintained with recent releases

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity32

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

40d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/230292847?v=4)[TERRAKERNEL PTE LTD](/maintainers/terrakernel)[@terrakernel](https://github.com/terrakernel)

---

Top Contributors

[![julianrichie](https://avatars.githubusercontent.com/u/1916616?v=4)](https://github.com/julianrichie "julianrichie (12 commits)")

---

Tags

odooodoo-integrationodxproxyphp

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/odxproxy-client/health.svg)

```
[![Health](https://phpackages.com/badges/odxproxy-client/health.svg)](https://phpackages.com/packages/odxproxy-client)
```

###  Alternatives

[psalm/phar

Composer-based Psalm Phar

265.7M230](/packages/psalm-phar)[cornernote/gii-modeldoc-generator

Gii ModelDoc Generator for Yii framework

13110.6k](/packages/cornernote-gii-modeldoc-generator)[xandros15/slim-pagination

simple pagination for slim3

118.4k](/packages/xandros15-slim-pagination)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
