esign/laradoo
Composer 安装命令:
composer require esign/laradoo
包简介
Odoo ERP API for Laravel
README 文档
README
Odoo ERP API for Laravel. Odoo website
Compatibility
| Laravel version | PHP version | Package version |
|---|---|---|
| ^8.0 | ^7.4 | ^V3.0 |
| ^5.1 | ^5.6 | ^V2.0 |
| ^5.1 | ^5.5 | ^V1.1 |
Installation
type in console:
composer require esign/laradoo
Register Laradoo service by adding it to the providers array.
'providers' => [ ... Esign\Laradoo\Providers\OdooServiceProvider::class, ],
Let's add the Alias facade, add it to the aliases array.
'aliases' => array( ... 'Odoo' => Esign\Laradoo\Facades\Odoo::class, )
Publish the package's configuration file to the application's own config directory
php artisan vendor:publish --provider="Esign\Laradoo\Providers\OdooServiceProvider" --tag="config"
Configuration
After publishing the package config file, the base configuration for laradoo package is located in config/laradoo.php
Also, you can dynamically update those values calling the available setter methods:
host($url), username($username), password($password), db($name), apiSuffix($name)
Usage samples
Instance the main Odoo class:
$odoo = new \Esign\Laradoo\Odoo();
You can get the Odoo API version just calling the version method:
$version = $odoo->version();
This methods doesn't require to be connected/Logged into the ERP.
Connect and log into the ERP:
$odoo = $odoo->connect();
All needed configuration data is taken from laradoo.php config file. But you always may pass new values on the fly if required.
$this->odoo = $this->odoo ->username('my-user-name') ->password('my-password') ->db('my-db') ->host('https://my-host.com') ->connect();
// Note:
hostshould contain 'http://' or 'https://'
After login, you can check the user identifier like follows:
$userId= $this->odoo->getUid();
You always can check the permission on a specific model:
$can = $odoo->can('read', 'res.partner');
Permissions which can be checked: 'read','write','create','unlink'
Method `search provides a collection of ids based on your conditions:
$ids = $odoo->where('customer', '=', true) ->search('res.partner');
You can limit the amount of data using limit method and use as many as condition you need:
$ids = $odoo->where('is_company', true) ->where('customer', '=', true) ->limit(3) ->search('res.partner');
If need to get a list of models, use the get method:
$models = $odoo->where('customer', true) ->limit(3) ->get('res.partner');
Instead of retrieving all properties of the models, you can reduce it by adding fields method before the method get
$models = $odoo->where('customer', true) ->limit(3) ->fields('name') ->get('res.partner');
If not sure about what fields a model has, you can retrieve the model structure data by calling fieldsOf method:
$structure = $odoo->fieldsOf('res.partner');
Till now we have only retrieved data from the ERP but you can also Create and Delete records.
In order to create a new record just call create method as follows:
$id = $odoo->create('res.partner',['name' => 'Jonh Odoo']);
The method returns the id of the new record.
For Deleting records we have the delete method:
$result = $odoo->where('name', 'Jonh Odoo') ->delete('res.partner');
Notice that before calling
deletemethod you have to usewhere.
You can also remove records by ids like follows:
$result = $odoo->deleteById('res.partner',$ids);
Update any record of your ERP:
$updated = $odoo->where('name', 'John Odoo') ->update('res.partner',['name' => 'John Odoo Odoo','email' => 'Johndoe@odoo.com']);
Notice that all delete and update methods always returns true except if there was an error.
call method is also available for those who want to set a custom API call:
$odoo->call('res.partner', 'search',[ [ ['is_company', '=', true], ['customer', '=', true] ] ],[ 'offset'=>1, 'limit'=>5 ]);
Full API list
esign/laradoo 适用场景与选型建议
esign/laradoo 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 45 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 04 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「package」 「laravel」 「ERP」 「odoo」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 esign/laradoo 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 esign/laradoo 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 esign/laradoo 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Simple ASCII output of array data
Bundle for managing synchronization of Serpa data with Sylius Sync Bundle
Connect your PHP driven web application with Open ERP
Alfabank REST API integration
Package for view storage in laravel
统计信息
- 总下载量: 45
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 12
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-04-21
