Download the PHP package wdelfuego/php-odoo-api-client without Composer

On this page you can find all versions of the php package wdelfuego/php-odoo-api-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-odoo-api-client

PHP Odoo API client

Build Status Latest Stable Version Latest Unstable Version Total Downloads

Odoo API client using XML-RPC Odoo ORM External API. It allows you call your odoo instance and manage records easily.

You are reading the documentation of version , if your version is older, please read this documentation (6.1.3). Please see the file UPGRADE-7.0.md to upgrade your version easily.

Main features

Good to know

If you are in Symfony application you should be interested in the bundle ang3/odoo-bundle (client integration).

Requirements

Odoo server Compatibility Comment
newer Unknown Needs feddback
v13.0 Yes Some Odoo model names changed (e.g account.invoice > account.move)
v12.0 Yes First tested version
< v12 Unknown Needs feddback

Installation

Open a command console, enter your project directory and execute the following command to download the latest stable version of the client:

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.

Basic usage

First, you have to create a client instance:

Exceptions:

Then, make your call:

Exceptions:

These previous exception can be thrown by all methods of the client.

DBAL (Database Abstraction Layer)

First of all, Odoo is a database. Each "model" is a table and has its own fields.

DBAL features was added in version - If your version is older, please use the built-in ORM methods of the client like explained in the dedicated documentation: be aware that these client ORM methods are deprecated since version .

Record manager

The client provides a record manager to manage records of your Odoo models.

You can get the related manager of the client like below:

You can also create your own with a client instance:

Built-in ORM methods

Here is all built-in ORM methods provided by the record manager:

For in select/search queries and for data writing context, please read the section Expression builder.

Schema

You can get the schema of your Odoo database by calling the getter method :

The schema helps you to get all model names or get metadata of a model.

Get all model names

Get model metadata

An exception of type is thrown if the model does not exist.

Query builder

It helps you to create queries easily by chaining helpers methods (like Doctrine for SQL databases).

Create a query builder

The variable represents the target model of your query (clause ).

Build your query

Here is a complete list of helper methods available in :

Then, build your query like below:

Your query is an instance of .

Execute your query

You can get/count results or execute insert/update/delete by differents ways depending on the query type.

Repositories

Sometimes, you would want to keep your queries in memory to reuse it in your code. To do it, you should use a repository. A repository is a class that helps you to isolate queries for a dedicated model.

For example, let's create the repository for your companies and define a query to get all french companies:

Note that Odoo will always return the record ID in the result, even if you didn't select it explicitly.

Each repository is registered inside the record manager on construct. That's why you can retrieve your repository directly from the record manager:

If no repository exists for a model, the default repository
is used. Last but not least, all repositories are stored into the related record manager to avoid creating multiple instances of same repository.

Expression builder

There are two kinds of expressions : for criteria and in data writing context. Odoo has its own array format for those expressions. The aim of the expression builder is to provide some helper methods to simplify your programmer's life.

Here is an example of how to get a builder from a client or record manager:

You can still use the expression builder as standalone by creating a new instance:

Domains

For all select/search/count queries, Odoo is waiting for an array of domains with a polish notation for logical operations (, and ).

It could be quickly ugly to do a complex domain, but don't worry the builder makes all for you. :-)

Each domain builder method creates an instance of . The only one method of this interface is to get a normalized array of the expression.

To illustrate how to work with it, here is an example using helper methods:

Of course, you can nest logical nodes:

Internally, the client formats automatically all domains by calling the special builder method .

Here is a complete list of helper methods available in for domain expressions:

Collection operations

In data writing context with queries of type insert/update, Odoo allows you to manage *toMany collection fields with special commands.

Please read the ORM documentation to known what we are talking about.

The expression builder provides helper methods to build a well-formed operation command: each operation method returns an instance of . Like domains, the only one method of this interface is to get a normalized array of the expression.

To illustrate how to work with operations, here is an example using helper methods:

Internally, the client formats automatically the whole query parameters for all writing methods ( and ) by calling the special builder method .

Here is a complete list of helper methods available in for operation expressions:

Data support

Resources


All versions of php-odoo-api-client with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2
ext-json Version *
ang3/php-xmlrpc-client Version ^1.0.2
psr/log Version ^1.1|^2.0|^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package wdelfuego/php-odoo-api-client contains the following files

Loading the files please wait ....