定制 asikam/softone 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

asikam/softone

Composer 安装命令:

composer require asikam/softone

包简介

A simple PHP Laravel package to interact with Softone ERP Web Services

README 文档

README

Softone Web Services PHP Laravel Package

A Laravel package that makes it easy to consume Softone ERP Web Services REST API.

Disclaimer: This is not an official package

Table of Contents

Introduction

This package provides a simple and elegant way to interact with the Softone Web Services REST API in your Laravel applications. It handles authentication, request building, and response parsing, allowing you to focus on your application logic.

Official Softone Web Services documentation: https://www.softone.gr/ws/

Requirements

  • PHP 7.4 or higher
  • Laravel 8.0 or higher

Installation

You can install the package via composer:

composer require asikam/softone

After installing, publish the configuration file:

php artisan vendor:publish --provider="Asikam\Softone\SoftoneServiceProvider"

Configuration

After publishing the configuration file, you can find it at config/softone.php. You'll need to set the following environment variables in your .env file:

COMPANY_AFM=your_company_afm
SOFTONE_URL=your_softone_url
SOFTONE_USER=your_username
SOFTONE_PASS=your_password
SOFTONE_APPID=your_app_id
SOFTONE_COMPANY=your_company_id
SOFTONE_BRANCH=your_branch_id
SOFTONE_MODULE=your_module_id
SOFTONE_REFID=your_ref_id

Usage

Using SoftoneBrowser

The SoftoneBrowser class provides a simplified interface for common operations:

use Asikam\Softone\SoftoneBrowser;

// Create a new instance
$softone = new SoftoneBrowser();

// Search for customers with a specific tax ID
$softone->search("CUSTOMER", 'CUSTOMER.AFM=000000000*=;');

// Or with named parameters
$softone->search(
    object: "CUSTOMER",
    filters: 'AFM=000000000=;',
    list: 'Web',
    start: 0,
    limit: 30
);

// Access the response data
foreach ($softone->responseData as $item) {
    echo $item['CUSTOMER.AFM'] . "\n";
    echo $item['CUSTOMER.NAME'] . "\n";
}

Building The Request

For more control, you can use the core Softone class to build your requests:

use Asikam\Softone\Softone;

// Create a new instance
$softone = new Softone();

// Get browser information
$softone->setService('getBrowserInfo');
$softone->setObject('CUSTOMER');
$softone->setFilters('CUSTOMER.AFM=000000*=;');
$softone->send();

// Get browser data using the request ID from the previous request
$softone->setService('getBrowserData');
$softone->setReqId($softone->reqID);
$softone->limit(10);
$softone->send();

// Access the response data
foreach ($softone->data as $item) {
    echo $item['CUSTOMER.NAME'] . "\n";
    echo $item['CUSTOMER.AFM'] . "\n";
}

Available Methods

SoftoneBrowser Methods

  • search($object, $filters, $list, $start, $limit): Combines getBrowserInfo and getBrowserData in one call
  • info($object, $filters, $list): Gets browser information for a specific object
  • getBrowserInfo($object, $filters, $list): Gets browser information for a specific object
  • getBrowserData($start, $limit): Gets browser data with pagination
  • getData($object, $key): Gets data for a specific object with a key

Softone Core Methods

The core Softone class provides numerous methods for building and sending requests:

  • setService($service): Sets the service to call (e.g., getBrowserInfo, getBrowserData)
  • setUsername($username): Sets the username for authentication
  • setPass($password): Sets the password for authentication
  • setAppId($appId): Sets the application ID
  • setCompany($company): Sets the company ID
  • setBranch($branch): Sets the branch ID
  • setModule($module): Sets the module ID
  • setRefid($refid): Sets the reference ID
  • setClientID($clientID): Sets the client ID
  • setObject($object): Sets the object to query (e.g., CUSTOMER, ITEM)
  • setKey($key): Sets the key for getData requests
  • setFilters($filters): Sets the filters for browser requests
  • setList($list): Sets the list for browser requests
  • locate($locate): Sets the locate info softone parameter
  • start($start): Sets the start parameter for pagination
  • limit($limit): Sets the limit parameter for pagination
  • setReqId($reqID): Sets the request ID for getBrowserData requests
  • setRequestData($data): Sets the request data
  • send(): Sends the request to the Softone Web Services API

Examples

Searching for Customers

use Asikam\Softone\SoftoneBrowser;

$softone = new SoftoneBrowser();
$softone->search("CUSTOMER", 'CUSTOMER.NAME=*Company*=;');

foreach ($softone->responseData as $item) {
    echo "Customer ID: " . $item['CUSTOMER.CODE'] . "\n";
    echo "Customer Name: " . $item['CUSTOMER.NAME'] . "\n";
    echo "Tax ID: " . $item['CUSTOMER.AFM'] . "\n";
    echo "-------------------\n";
}

Getting a Specific Customer by ID

use Asikam\Softone\Softone;

$softone = new Softone();
$softone->setService('getData');
$softone->setObject('CUSTOMER');
$softone->setKey('1001'); // Customer ID
$softone->send();

$customer = $softone->data;
echo "Customer Name: " . $customer['NAME'] . "\n";
echo "Tax ID: " . $customer['AFM'] . "\n";

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This package is open-sourced software licensed under the MIT license.

For more information on how to use the Softone Web Services, please refer to the official documentation.

asikam/softone 适用场景与选型建议

asikam/softone 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 32 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 12 月 10 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「framework」 「curl」 「http」 「rest」 「http client」 「client」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 asikam/softone 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 asikam/softone 我们能提供哪些服务?
定制开发 / 二次开发

基于 asikam/softone 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 32
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 7
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-12-10