PHPackages                             obuchmann/odoo-json-api - 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. [API Development](/categories/api)
4. /
5. obuchmann/odoo-json-api

ActiveLibrary[API Development](/categories/api)

obuchmann/odoo-json-api
=======================

PHP wrapper for the Odoo JSON-2 API (Odoo 19+)

00PHPCI failing

Since Apr 3Pushed 3mo agoCompare

[ Source](https://github.com/obuchmann/odoo-json-api)[ Packagist](https://packagist.org/packages/obuchmann/odoo-json-api)[ RSS](/packages/obuchmann-odoo-json-api/feed)WikiDiscussions main Synced today

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Odoo JSON API
=============

[](#odoo-json-api)

PHP client for the Odoo JSON-2 API (Odoo 19+).

This library provides a clean, type-safe wrapper around Odoo's new JSON-2 external API, which replaces the legacy XML-RPC and JSON-RPC interfaces.

Requirements
------------

[](#requirements)

- PHP 8.3+
- A PSR-18 HTTP client (e.g., Guzzle 7.5+)

Installation
------------

[](#installation)

```
composer require obuchmann/odoo-json-api
```

If you don't already have a PSR-18 HTTP client installed:

```
composer require guzzlehttp/guzzle
```

Quick Start
-----------

[](#quick-start)

```
use Obuchmann\OdooJsonApi\Config;
use Obuchmann\OdooJsonApi\Odoo;

$config = new Config(
    url: 'https://your-odoo-instance.com',
    apiKey: 'your-api-key',
    database: 'your-database', // optional if dbfilter is configured
);

$odoo = new Odoo($config);

// Search and read partners
$partners = $odoo->searchRead('res.partner', fields: ['name', 'email'], limit: 10);
```

Usage
-----

[](#usage)

### Configuration

[](#configuration)

```
use Obuchmann\OdooJsonApi\Config;

$config = new Config(
    url: 'https://your-odoo-instance.com',
    apiKey: 'your-api-key',
    database: 'mydb',       // optional
);
```

### Direct Methods

[](#direct-methods)

```
use Obuchmann\OdooJsonApi\Domain;

// Search and read
$partners = $odoo->searchRead('res.partner', fields: ['name', 'email'], limit: 10);

// Search with domain filter
$domain = new Domain();
$domain->where('is_company', '=', true)
       ->where('country_id', '=', 14);

$companies = $odoo->searchRead('res.partner', $domain, fields: ['name']);

// Search for IDs only
$ids = $odoo->search('res.partner', $domain);

// Read by IDs
$records = $odoo->read('res.partner', [1, 2, 3], fields: ['name', 'email']);

// Count
$count = $odoo->count('res.partner', $domain);

// Create
$id = $odoo->create('res.partner', [
    'name' => 'New Partner',
    'email' => 'partner@example.com',
]);

// Update
$odoo->write('res.partner', [$id], ['name' => 'Updated Name']);

// Delete
$odoo->unlink('res.partner', [$id]);

// Get field definitions
$fields = $odoo->fieldsGet('res.partner', ['string', 'type']);

// Call any method
$result = $odoo->execute('res.partner', 'custom_method', ['param' => 'value']);
```

### Fluent Request Builder

[](#fluent-request-builder)

```
// Fluent interface scoped to a model
$partners = $odoo->model('res.partner')
    ->where('is_company', '=', true)
    ->fields(['name', 'email', 'phone'])
    ->orderBy('name asc')
    ->limit(20)
    ->offset(0)
    ->get();

// Get first matching record
$partner = $odoo->model('res.partner')
    ->where('email', '=', 'user@example.com')
    ->fields(['name', 'email'])
    ->first();

// Find by ID
$partner = $odoo->model('res.partner')
    ->fields(['name', 'email'])
    ->find(42);

// Count
$count = $odoo->model('res.partner')
    ->where('active', '=', true)
    ->count();

// CRUD via builder
$id = $odoo->model('res.partner')->create(['name' => 'New']);
$odoo->model('res.partner')->update([1, 2], ['active' => false]);
$odoo->model('res.partner')->delete([1, 2]);
```

### Domain Filters

[](#domain-filters)

```
use Obuchmann\OdooJsonApi\Domain;

$domain = new Domain();
$domain->where('name', 'ilike', 'test')
       ->where('active', '=', true)
       ->orWhere('email', '!=', false);
```

### Context

[](#context)

```
use Obuchmann\OdooJsonApi\Context;

$context = new Context(['lang' => 'fr_FR', 'tz' => 'Europe/Paris']);

$partners = $odoo->searchRead('res.partner', context: $context);
```

### Custom HTTP Client

[](#custom-http-client)

You can provide your own PSR-18 client:

```
use GuzzleHttp\Client as GuzzleClient;
use GuzzleHttp\Psr7\HttpFactory;

$httpClient = new GuzzleClient(['timeout' => 30]);
$factory = new HttpFactory();

$odoo = new Odoo($config, $httpClient, $factory, $factory);
```

Testing
-------

[](#testing)

```
# Unit tests
composer test:unit

# Static analysis
composer analyse
```

### Integration Tests

[](#integration-tests)

Integration tests require a running Odoo 19 instance with an API key:

```
# Start Odoo via Docker
cd docker && docker compose up -d

# Run integration tests
ODOO_HOST=http://localhost:8069 ODOO_API_KEY=your-key ODOO_DATABASE=odoo composer test:integration
```

License
-------

[](#license)

MIT

###  Health Score

19

—

LowBetter than 9% of packages

Maintenance55

Moderate activity, may be stable

Popularity0

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity14

Early-stage or recently created project

 Bus Factor1

Top contributor holds 60% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/83928edc2d003cd4111054a2726f6169e9fee92cf5a4cba0016e968fadeb18c8?d=identicon)[obuchmann](/maintainers/obuchmann)

---

Top Contributors

[![claude](https://avatars.githubusercontent.com/u/81847?v=4)](https://github.com/claude "claude (3 commits)")[![obuchmann](https://avatars.githubusercontent.com/u/3889302?v=4)](https://github.com/obuchmann "obuchmann (2 commits)")

### Embed Badge

![Health badge](/badges/obuchmann-odoo-json-api/health.svg)

```
[![Health](https://phpackages.com/badges/obuchmann-odoo-json-api/health.svg)](https://phpackages.com/packages/obuchmann-odoo-json-api)
```

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35916.4M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24016.2M20](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172445.0k16](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

93459.5k6](/packages/botman-driver-telegram)

PHPackages © 2026

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