承接 eleven-labs/api-service 相关项目开发

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

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

eleven-labs/api-service

Composer 安装命令:

composer require eleven-labs/api-service

包简介

README 文档

README

Build Status Code Coverage Scrutinizer Quality Score

This component read API service descriptions written in OpenAPi/Swagger 2.0 in order serialize requests, and parse responses into easy to use model structures.

Dependencies

This component rely on well known interfaces that discribe:

Installation

This library can be easily installed via composer

composer require eleven-labs/api-service

Usage

In order to consume an API, you will need to write an API service description.

As of now, we only support swagger files, but we plan to support RAML 1.0 and Api Blueprint in a near future.

For standalone projects usage of the provided builder is encouraged:

<?php
$apiService = ElevenLabs\Api\Service\ApiServiceBuilder::create()->build('file:///absolute/path/to/your/schema.json');

$operationId = 'getSomething';
$parameters = ['foo' => 'bar'];

// A Synchronous Request

/** @var \ElevenLabs\Api\Service\Resource\Resource $resource */
$resource = $apiService->call($operationId, $parameters);

// An Asynchronous Request

$promise = $apiService->callAsync($operationId, $parameters);
/** @var \ElevenLabs\Api\Service\Resource\Resource $resource */
$resource = $promise->wait();

Important: You MUST provide an operationId for each paths described in your swagger file.

Builder Dependencies

You will need one of the HttpClient adapter provided by HttPlug and the HTTP Client Discovery Service.

# install the discivery service
composer require php-http/discovery
# install one of the http client adapter (here, we use the guzzle6 adapter)
composer require php-http/guzzle6-adapter

Builder configuration

The builder provide additional methods to fine tune your API Service:

  • withCacheProvider(CacheItemPoolInterface $cacheProvider)

    Cache the API service description using a PSR-6: Cache Interface

  • withHttpClient(HttpClient $httpClient)

    Provide an HttpClient implementing the Http\Client\HttpClient interface.
    By default, it will use the Http\Discovery\HttpClientDiscovery::find() method

  • withMessageFactory(MessageFactory $messageFactory)

    Provide a MessageFactory implementing the Http\Message\MessageFactory interface.
    By default, it will use the Http\Discovery\MessageFactoryDiscovery::find() method

  • withUriFactory(UriFactory $uriFactory)

    Provide an UriFactory implementing the Http\Message\UriFactory interface.
    By default, it will use the Http\Discovery\UriFactory::find() method

  • withSerializer(SerializerInterface $serializer)

    Provide a Serializer. By default, it will use the Symfony Serializer.

  • withEncoder(EncoderInterface $encoder)

    Add an encoder to encode Request body and decode Response body.
    By default, it register Symfony's JsonEncoder and XmlEncoder.

  • withPaginationProvider(PaginationProvider $paginatorProvide)

    When using the default ResourceDenormalizer, you can provide a pagination provider to add pagination informations into Collection objects. Available implementations can be found in the src/Pagination/Provider folder. You can create your own by implementing the ElevenLabs\Api\Service\Pagination\PaginationProvider interface.

  • withDenormalizer(NormalizerInterface $normalizer)

    Add a denormalizer used to denormalize Response decoded body.
    By default, it use the ElevenLabs\Api\Service\Denormalizer\ResourceDenormalizer that denormalize a Response into a Resource object. A Resource object can be an Item or a Collection.

  • withBaseUri($baseUri)

    Provide a base URI from which your API is exposed.
    By default, it will use your the schemes key and host key defined in your API service description.

  • disableRequestValidation()

    Disable Request validation against your API service description. Enabled by default

  • enableResponseValidation()

    Enable Response validation against your API service description. Disabled by default.

  • returnResponse()

    Return a PSR-7 Response when using ApiService call() and callAsync() methods instead of a denormalized object.

  • setDebug($bool)

    Enable debug mode. When enabled, it will expire the schema cache immediatly if a cache implementation is provided using the withCacheProvider(CacheItemPoolInterface $cacheProvider) method.

eleven-labs/api-service 适用场景与选型建议

eleven-labs/api-service 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 200 次下载、GitHub Stars 达 7, 最近一次更新时间为 2016 年 08 月 02 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 eleven-labs/api-service 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 7
  • Watchers: 2
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2016-08-02