alazzi-az/laraodoo-xmlrpc
Composer 安装命令:
composer require alazzi-az/laraodoo-xmlrpc
包简介
Odoo-Xmlrpc PHP for Laravel is a supercharged PHP API client that allows you to interact with the Odoo XML-RPC API
README 文档
README
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
- PHP 8.1 or later
Get Started
First, install laraodoo-xmlrpc via the Composer package manager:
composer require alazzi-az/laraodoo-xmlrpc
Next, publish the configuration file:
php artisan vendor:publish --provider="Alazzidev\LaraodooXmlrpc\ServiceProvider"
This will create a config/odoo-xmlrpc..php configuration file in your project, which you can modify to your needs using environment variables:
return [ 'url' => env('ODOO_URL', ''), 'suffix' => 'xmlrpc/2', 'db' => env('ODOO_DB', ''), 'username' => env('ODOO_USERNAME', ''), 'password' => env('ODOO_PASSWORD', ''), ];
Finally, you may use the Odoo facade to access the Odoo Xml API:
use Alazzidev\LaraodooXmlrpc\Facades\Odoo; $result = Odoo::model('res.partner')->create([ 'test1'=>'test1-value', 'test2'=>'test2-value' ]);
Usage
For usage examples, take a look at the alazzi-az/odoo-xmlrpc repository.
Use Case
For Create Invoice in Cummonity Version "account.move"
use Alazzidev\LaraodooXmlrpc\Facades\Odoo; // Define invoice line $line = [ 0, false, [ 'currency_id' => $currency_id, 'discount' => $discountPercentage, 'display_type' => 'product', 'name' => $name, 'price_unit' => $price_unit, 'product_id' => $product_id, 'quantity' => $quantity, 'tax_ids' => $tax_ids, ] ]; $invoice_lines = [$line]; // Define invoice data $invoice = [ 'partner_id' => $partner_id, 'name' => $name, 'invoice_date' => $invoice_date, 'invoice_date_due' => $invoice_date_due, 'payment_reference' => $payment_reference, 'invoice_line_ids' => $invoice_lines, 'currency_id' => $currency_id, 'invoice_payment_term_id' => $payment_term_id, 'state' => $state, 'journal_id' => $journal_id, 'move_type' => 'out_invoice', ]; // Create invoice using Odoo External API $odoo = Odoo::model('account.move'); $odoo_invoice_id = $odoo->create($invoice);
Testing
The Odoo facade comes with a fake() method that allows you to fake the API responses.
The fake responses are returned in the order they are provided to the fake() method.
All responses are having a fake() method that allows you to easily create a response object by only providing the parameters relevant for your test case.
use Alazzidev\LaraodooXmlrpc\Facades\Odoo; Odoo::fake([ 'test1'=>'test1-value', 'test2'=>'test2-value' ]); $response = Odoo::create('res.partner',[ 'test1'=>'test1-value', 'test2'=>'test2-value' ]); expect($response['test1'])->toBe('test1-value');
And here You Can run test
composer test:unit
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.
alazzi-az/laraodoo-xmlrpc 适用场景与选型建议
alazzi-az/laraodoo-xmlrpc 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 8.66k 次下载、GitHub Stars 达 20, 最近一次更新时间为 2023 年 07 月 22 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 alazzi-az/laraodoo-xmlrpc 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 alazzi-az/laraodoo-xmlrpc 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 8.66k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 20
- 点击次数: 15
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-07-22