Skip to content

Commit 259988d

Browse files
committed
First commit
0 parents  commit 259988d

File tree

9 files changed

+565
-0
lines changed

9 files changed

+565
-0
lines changed

.env.example

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Odoo Production credentials
2+
ODOO_API_URL=https://example.com
3+
ODOO_API_PORT=443
4+
ODOO_API_DATABASE="database-name"
5+
ODOO_API_USER="user-name"
6+
ODOO_API_PASSWORD="password"

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
vendor
2+
.idea
3+
.composer.lock

README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Consilience Laravel Odoo XML RPC Client
2+
3+
Tested against Laravel 5.7 and Odoo 7.
4+
5+
More docs to do, examples to wite, and the write interfaces to produce.
6+
7+
# Example
8+
9+
A very simple example:
10+
11+
```php
12+
use OdooApi;
13+
14+
$client = OdooApi::getClient();
15+
16+
// Note the criteria is a nested list of scalar values.
17+
// The datatypes will converted to the appropriate objects internally.
18+
// You can mix scalars and objects here to force the datatype, for example
19+
// ['name', $client->stringValue('ilike'), 'mich']
20+
21+
$criteria = [
22+
[
23+
'name',
24+
'ilike',
25+
'mich'
26+
]
27+
];
28+
29+
// First 10 macthing IDs
30+
31+
$client->search('res.partner', $criteria, 0, 10, 'id desc')->value()->me['array']
32+
33+
// Total count for the criteria.
34+
35+
$client->searchCount('res.partner', $criteria);
36+
```
37+
38+
# TOOD
39+
40+
An elegant way to parse the results, as the `Value` objects can be
41+
a little cumbersome.
42+
For example, we know the `search()` result will be an array of
43+
integer model instance IDs, so a simple array of IDs can be returned,
44+
rather than a Value array containing Value integer objects.

composer.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "consilience/laravel-odoo-api-client",
3+
"description": "Laravel provider for the Odoo API",
4+
"authors": [
5+
{
6+
"name": "Jason Judge",
7+
"email": "[email protected]"
8+
}
9+
],
10+
"license": "MIT",
11+
"require": {
12+
"php": ">= 7.0.0",
13+
"phpxmlrpc/phpxmlrpc": "~4.0"
14+
},
15+
"autoload": {
16+
"psr-4": {
17+
"Consilience\\OdooApi\\": "src/"
18+
}
19+
},
20+
"extra": {
21+
"laravel": {
22+
"providers": [
23+
"Consilience\\OdooApi\\OdooServiceProvider"
24+
],
25+
"aliases": {
26+
"OdooApi": "Consilience\\OdooApi\\OdooFacade"
27+
}
28+
}
29+
}
30+
}

config/odoo-api.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
return [
4+
// The default configuration set.
5+
6+
'default' => 'default',
7+
8+
// The connection configuration sets.
9+
10+
'connections' => [
11+
'default' => [
12+
'url' => env('ODOO_API_URL'),
13+
'port' => env('ODOO_API_PORT', '443'),
14+
'database' => env('ODOO_API_DATABASE'),
15+
'username' => env('ODOO_API_USER'),
16+
'password' => env('ODOO_API_PASSWORD'),
17+
],
18+
],
19+
];

0 commit comments

Comments
 (0)