fmarquesto/sap-business-one-connector
最新稳定版本:1.0.1
Composer 安装命令:
composer require fmarquesto/sap-business-one-connector
包简介
Utility to connect with SAP Business One through the Service Layer API
README 文档
README
A lightweight PHP library for connecting and interacting with SAP Business One.
🚀 Features
- Connect to SAP Business One (SAP B1) using HTTP/REST
- Lightweight and easy to integrate
- Built on top of Guzzle for HTTP requests
- Environment-based configuration with Dotenv
- Designed with extensibility and testability in mind
🧰 Requirements
- PHP ^8.2
- SAP Business One with Service Layer API access
- Composer
📦 Installation
composer require fmarquesto/sap-business-one-connector
🛠 Usage
🧪 Basic Setup
use fmarquesto\SapBusinessOneConnector\Client; // Load environment variables $client = new Client(); // Automatically loads from .env file in the project root // Or specify configuration directly $connectionData = new \fmarquesto\SapBusinessOneConnector\ConnectionData('https://your-sap-b1-service-layer-url', '50000', 'Database', 'UserName', 'Password'); $client = new Client(connectionData: $connectionData);
Environment variables
SAP_HOST="https://xxxx" SAP_PORT=50000 SAP_USER=user SAP_PASS=pass SAP_DB=DB
📥 GET Example: Fetch Items
use fmarquesto\SapBusinessOneConnector\Client; use fmarquesto\SapBusinessOneConnector\QueryBuilder; use fmarquesto\SapBusinessOneConnector\Resources; $client = new Client(); $response = $client->execute( (new QueryBuilder(Resources::Items, top:21)) ->addSelect('ItemCode', 'ItemName') ); $response->success(); // true $response->hasNextPage(); // true $response->nextPage(); // Items?$select=ItemCode,%20ItemName&$top=1&$skip=20 $response->arrayBody(); // ['odata.metadata' => 'metadataurl', 'value' => [['ItemCode' => 'A00001', 'ItemName' => 'Item 1'], ...]], 'odata.nextLink' => 'nextlinkurl']
🧪 Testing
composer test
📜 License
MIT © Fede Marquesto
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-06-07