承接 foobarfighters/zend-server-web-api 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

foobarfighters/zend-server-web-api

Composer 安装命令:

composer require foobarfighters/zend-server-web-api

包简介

PHP wrapper for the Zend Server Web API

README 文档

README

A Guzzle based wrapper for (a part of) the Zend Server Web API. Has no dependencies with any framework. Check the traits in ZendServer/WebApi/Client/Core/Method for the endpoints that are currently supported.

Installation

The package can be installed with composer:

composer require foobarfighters/zend-server-web-api

Usage

When making use of the ClientFactory the Zend Server credentials can be passed as an array. Alternatively these values can be passed directly into the constructor of the client when instantiating it manually.

<?php

$config = [
    'baseUrl' => 'https://your.zend.server.url',

    //== ZendServer admin > Administration > Web API Keys > UserName
    'username' => 'foobar',

    //== ZendServer admin > Administration > Web API Keys > Hash
    'hash' => 'f1ghtErs6fddd00ccec4eb1b261a8f6cc2dad94c1eb100eab',

    //== see https://help.zend.com/zend/current/content/web_api_reference_guide.htm
    'version' => 1.23,
];

Core Client

The core client is responsible for making the API request, returning the response as an associative array or throwing exceptions if anything goes wrong.

use FooBarFighters\ZendServer\WebApi\Client\ClientFactory;

try{
    //== instantiate a core client
    $client = ClientFactory::createClient($config);
    
    //== get the raw API data as an associative array
    $res = $client->applicationGetStatus();
    
    //== do something useful with it
    print_r($res['responseData']);
}

//== one size fits all
catch(Exception $e){
    error_log($e);
    echo 'stay calm, the internet police has been notified!';
}

Extended Client

The extended client decorates the core client and maps the raw API output to data models. These models offer additional benefits like filtering, date parsing and autocompletion in IDE's.

use FooBarFighters\ZendServer\WebApi\Client\ClientFactory;

try{
    //== instantiate an extended client
    $client = ClientFactory::createExtendedClient($config);
    
    //== reduce the list of applications to a single app model
    $myApp = $client->getAppList()->filterByName('myAppName');
    
    //== do something very exciting with it
    echo $myApp->getId();
}

//== several types of specific exceptions can be thrown, like Guzzle or Api related
catch(\FooBarFighters\ZendServer\WebApi\Exception\ApiException $e){
    echo 'You broke the API!';
}

Custom Guzzle

A custom Guzzle client can be passed to either the ClientFactory, or the Client class. This can be useful for adding headers, middleware or custom handlers. See the examples bootstrap file for how to add Monolog logging middleware.

$handlerStack = HandlerStack::create();
//== add middleware or custom handlers
...
$client = ClientFactory::createExtendedClient($config, new Guzzle(['handler' => $handlerStack]));

Examples

For more examples see the examples folder.

cd vendor/foobarfighters/ZendServer
php -S localhost:8080 -t examples

The examples can make actual calls to a Zend Server instance or be run either in mocked mode.

Mock mode

When running an example in mocked mode all the API responses are injected from a set of json files instead of connecting to a Zend Server instance.

Live mode

Note that in live mode:

  • ZS credentials need to be stored in vhost environmentals or alter the config array in the bootstrap file.
  • Requests/responses are logged in the logs folder. This requires write access.

foobarfighters/zend-server-web-api 适用场景与选型建议

foobarfighters/zend-server-web-api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 11 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 06 月 13 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 foobarfighters/zend-server-web-api 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-06-13