PHPackages                             alazzi-az/odoo-xmlrpc - 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. alazzi-az/odoo-xmlrpc

ActiveLibrary[API Development](/categories/api)

alazzi-az/odoo-xmlrpc
=====================

PHP package that provides a simple and easy-to-use interface for interacting with the Odoo XML-RPC API

v1.0.8(1y ago)2816.6k↓25%81MITPHPPHP ^8.1.0CI passing

Since Jul 22Pushed 10mo ago2 watchersCompare

[ Source](https://github.com/alazzi-az/odoo-xmlrpc)[ Packagist](https://packagist.org/packages/alazzi-az/odoo-xmlrpc)[ Docs](https://github.com/alazzi-az/odoo-xmlrpc)[ RSS](/packages/alazzi-az-odoo-xmlrpc/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (8)Dependencies (4)Versions (11)Used By (1)

Odoo XML-RPC Client
===================

[](#odoo-xml-rpc-client)

[![Latest Version on Packagist](https://camo.githubusercontent.com/2c8b203612e35947dbb59b77142bd735dcef9d5c7e0f5854fbc78757390ac926/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616c617a7a692d617a2f6f646f6f2d786d6c7270632e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/alazzi-az/odoo-xmlrpc)[![GitHub Tests Action Status](https://camo.githubusercontent.com/1597edcbd6a327746d53c9425586919c0ce3c96db75c38dc19f1551c7708022f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f616c617a7a692d617a2f6f646f6f2d786d6c7270632f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/alazzi-az/odoo-xmlrpc/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/16fc14115c2c542ba5023e064c4678137314e2ba09d967bbdbc85aea27bd6a0d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f616c617a7a692d617a2f6f646f6f2d786d6c7270632f466978253230504850253230636f64652532307374796c652532306973737565733f6c6162656c3d636f64652532307374796c65)](https://github.com/alazzi-az/odoo-xmlrpc/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/11ae1721287934aa99a1a6b759b7772b649edf5b4c3fcb69aa3b2ffe116ae8c2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616c617a7a692d617a2f6f646f6f2d786d6c7270632e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/alazzi-az/odoo-xmlrpc)

---

The **Odoo XML-RPC Client** is a PHP package that provides a simple and easy-to-use interface for interacting with the Odoo XML-RPC API. Unlike other Odoo clients that require extensions or other dependencies, this client uses the laminas/laminas-xmlrpc package, which is a pure PHP implementation of the XML-RPC protocol.

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

[](#requirements)

- PHP 8.1 or later
- The laminas/laminas-xmlrpc package

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

[](#installation)

You can install the package via composer:

```
composer require alazzi-az/odoo-xmlrpc
```

Usage
-----

[](#usage)

To use the Odoo XML-RPC Client, first create an instance of the OdooClient class:

```
use AlazziAz\OdooXmlrpc\Odoo;

$client = Odoo::client('https://your-odoo-instance.com','xmlrpc/2', 'database', 'username', 'password');
```

Replace , database, username, and password with the appropriate values for your Odoo instance.

### Then you can use Odoo Client

[](#then-you-can-use-odoo-client)

```
use AlazziAz\OdooXmlrpc\Client;

// Call a method on the Odoo server
$result = $client->call('res.partner', 'search_read', [], ['limit' => 5]);

// Get records from a model
$records = $client->get('res.partner', [], ['name', 'id'], 5);

// Search for records in a model
$searchResult = $client->search('res.partner', []);

// Read records from a model
$records = $client->read('res.partner', $searchResult, ['name', 'id']);

// Create a new record in a model
$id = $client->create('res.partner', [
    'name' => 'John Doe',
    'email' => 'johndoe@example.com'
]);

// Update an existing record in a model
$result = $client->update('res.partner', [$id], [
    'name' => 'Jane Doe',
    'email' => 'janedoe@example.com'
]);

// Delete a record from a model
$result = $client->delete('res.partner', [$id]);

// Get the number of records in a model
$count = $client->count('res.partner', []);

// Get the current user's ID
$uid = $client->getUid();

// Get the version of the Odoo server
$version = $client->getVersion();
```

### Use Query Builder

[](#use-query-builder)

- To create a new instance of the QueryBuilder class, you need to provide the name of the model to query and an instance of the OdooClient class or using model method in client object ```
    // Create a new instance of the QueryBuilder using the model method
    $queryBuilder = $client->model('res.partner');

    // Or create a new instance of the QueryBuilder using the constructor
    $queryBuilder = new QueryBuilder('res.partner', $client);
    ```
- And here is usage examples:

```
// Query with difference conditions cluose
    $result = $queryBuilder
      ->where('id', '=', 5)
      ->orWhere('id', '=', 6)
      ->whereIn('id', [11, 10])
      ->whereNotIn('id', [100, 200])
      ->whereNull('id')
      ->whereNotNull('id')
      ->whereBetween('id', [10,99])
      ->whereNotBetween('id', [500, 600])
      ->whereNotBetween('id', [100, 200])
      ->get();

// You can provide multiple arguments to select multiple fields
   $result = $queryBuilder->select('id', 'name')->get();

// retrieve the first record that matches the query.
   $result = $queryBuilder->first();

//  limit the number of records returned by the query.
   $result = $queryBuilder->limit(5)->get();

//  sort the records returned by the query.
   $result = $queryBuilder->order('name')->get();

// retrieve the records that match the query. It returns an array of records
   $records = $queryBuilder->where('name', 'ilike', 'johndoe')
                    ->get();

// retrieve the number of records that match the query:
   $result = $queryBuilder->count();

// retrieve a record by its ID. You need to provide the ID as the first argument
   $result = $queryBuilder->find($createResult);

// create a new record. You need to provide an array of data to create the record
   $result = $queryBuilder->create([
        'name' => 'test',
        'email' => 't@t.t']
     );

//  update one or more records. You need to provide an array of data to update the records
   $result = $queryBuilder->where('id', '=', 4)->update([
        'name' => 'test2'
        ]);

// retrieve the IDs of the records that match the query
   $result = $queryBuilder->ids();

// delete the records that match the query
   $result = $queryBuilder->where('id', '=', 5)->delete();
```

### Creating a Class for Model

[](#creating-a-class-for-model)

To create a class for a model, you can follow this example:

```
namespace Your\Namespace;

use AlazziAz\OdooXmlrpc\OdooClient;
use AlazziAz\OdooXmlrpc\QueryBuilder;
use AlazziAz\OdooXmlrpc\Concern\Resourceable;

class OdooPartner implements \AlazziAz\OdooXmlrpc\Interfaces\OdooResource
{
    use Resourceable;

    public static function getModelName(): string
    {
        return 'res.partner';
    }

    public static function getModelFields(): array
    {
        return ['name', 'email'];
    }
}

// To use the class, you need to boot it:
OdooPartner::boot($odooClient);

// Now you can use the class to perform CRUD operations:
$partners = OdooPartner::query()->get();
foreach ($partners as $partner) {
    echo $partner['name'] . ': ' . $partner['email'] . "\n";
}

$newPartnerId = OdooPartner::create([
    'name' => 'John Doe',
    'email' => 'johndoe@example.com',
]);

OdooPartner::update($newPartnerId, [
    'name' => 'John Doe Jr.',
    'email' => 'john.doe@example.com',
]);

OdooPartner::delete($newPartnerId);

$partnerCount = OdooPartner::count();

$searchResult = OdooPartner::search([
    ['name', 'ilike', 'johndoe'],
    ['email', 'ilike', 'john.doe@example.com'],
]);

$partners = OdooPartner::read($searchResult, ['name', 'email']);
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/alazzi-az/.github/blob/main/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Mohammed Ali Azman](https://github.com/alazzi-az)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance46

Moderate activity, may be stable

Popularity38

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

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

Every ~56 days

Recently: every ~112 days

Total

9

Last Release

577d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/750a1566a9f2ed8de9e8da9fee372b4426d7585bfdabdb65a1932a40e409a3e3?d=identicon)[alazzi](/maintainers/alazzi)

---

Top Contributors

[![mohammedazman](https://avatars.githubusercontent.com/u/56982649?v=4)](https://github.com/mohammedazman "mohammedazman (24 commits)")[![amoradel](https://avatars.githubusercontent.com/u/10636860?v=4)](https://github.com/amoradel "amoradel (1 commits)")[![eekes](https://avatars.githubusercontent.com/u/9445616?v=4)](https://github.com/eekes "eekes (1 commits)")[![vipin-kutthi-webkul](https://avatars.githubusercontent.com/u/183087579?v=4)](https://github.com/vipin-kutthi-webkul "vipin-kutthi-webkul (1 commits)")

---

Tags

odooodoo-xmlrpcalazzi-azodoo-phpphp-xmlrpc

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/alazzi-az-odoo-xmlrpc/health.svg)

```
[![Health](https://phpackages.com/badges/alazzi-az-odoo-xmlrpc/health.svg)](https://phpackages.com/packages/alazzi-az-odoo-xmlrpc)
```

###  Alternatives

[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[edujugon/laradoo

Odoo ERP API for Laravel

16468.6k](/packages/edujugon-laradoo)[tbondois/odoo-ripcord

Ripoo : a PHP8 XML-RPC client handler for Odoo External API

16124.3k1](/packages/tbondois-odoo-ripcord)[spejder/odoo-client

A PHP Client for Odoo

1016.8k2](/packages/spejder-odoo-client)

PHPackages © 2026

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