定制 reliv/axosoft-api 二次开发

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

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

reliv/axosoft-api

最新稳定版本:1.6.0

Composer 安装命令:

composer require reliv/axosoft-api

包简介

Module Axosift API wrapper

README 文档

README

Description

PHP wrapper for Axosoft API

Developers

This package contains a basic framework and a class structure for wrapping the API for AxoSoft (On-Time).

Please help us finish these API classes. We have only written a limited number of classes to support our needs.

If you wish to use the API library and an API classe you require is missing, you may utilize the Generic classes to build requests.

Example of standard list call

    // Get AxosoftApi from ZF2 service manager
    $axosoftApi = $this->getServiceLocator()->get('Reliv\AxosoftApi\Service\AxosoftApi');

    // Build request
    $request = new ApiRequestList();
    $request->setProjectId(10);
    $request->setSearchString('search for me');
    $request->setSearchField('name');
    $request->setPage(1);
    $request->setPageSize(1);

    // Get Response
    $response = $axosoftApi->send($request);
    
    // Handle error
    if ($axosoftApi->hasError($response)) {
        throw new \Exception('Call Failed.');
    }
    
    $dataArray = $response->getResponseData();
    $someValue = $response->getResponseProperty('somekey');

Example of generic list call

    // Get AxosoftApi from ZF2 service manager
    $axosoftApi = $this->getServiceLocator()->get('Reliv\AxosoftApi\Service\AxosoftApi');

    // Build request
    $request = new GenericApiRequest('/api/v5/items');

    $request->setRequestParameter('project_id', 10);
    $request->setRequestParameter('search_string', 'search for me');
    $request->setRequestParameter('search_field', 'name');
    $request->setRequestParameter('page', 1);
    $request->setRequestParameter('page_size', 1);

    // Get Response
    $response = $axosoftApi->send($request);
    
    // Handle error
    if ($axosoftApi->hasError($response)) {
        throw new \Exception('Call Failed.');
    }
    
    $dataArray = $response->getResponseData();
    $someValue = $response->getResponseProperty('somekey');

ToDo

  • Write the rest of the API classes
  • Create API request validators
  • May implement command pattern to simplify API calls

统计信息

  • 总下载量: 3.24k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 4
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 10
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2015-04-23